Skip to content

Commit bee3e1d

Browse files
committed
Correct error
1 parent fdf65f0 commit bee3e1d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

pcd.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ var (
4949
ErrCouldNotDownload = errors.New("Could not download episode")
5050
ErrCouldNotReadFromCache = errors.New("Could not read episodes from cache. Perform a sync and try again.")
5151
ErrCouldNotParseContent = errors.New("Could not parse the content from the feed")
52-
ErrFileAlreadyExists = errors.New("File already exists")
5352
)
5453

5554
func (p *Podcast) Sync() error {
@@ -173,7 +172,7 @@ func (e *Episode) Download(path string, writer io.Writer) error {
173172
fpath := filepath.Join(path, filename)
174173

175174
if _, err := os.Stat(fpath); !os.IsNotExist(err) {
176-
return ErrFileAlreadyExists
175+
return ErrFilesystemError
177176
}
178177

179178
res, err := http.Get(e.URL)

pcd_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func TestInvalidDownload(t *testing.T) {
236236
}{
237237
{"invalid url", &Episode{URL: "invalid"}, randomPath(t), nil, ErrCouldNotDownload},
238238
{"invalid status", &Episode{URL: testServerWithStatusCode(404).URL}, randomPath(t), nil, ErrCouldNotDownload},
239-
{"invalid path", &Episode{URL: testServer().URL}, "/root/access", nil, ErrCouldNotDownload},
239+
{"invalid path", &Episode{URL: testServer().URL}, "/root/access", nil, ErrFilesystemError},
240240
}
241241

242242
for _, e := range table {

0 commit comments

Comments
 (0)