Skip to content

Commit

Permalink
chore: remove unnecessary error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Apr 28, 2024
1 parent 94b7360 commit dc83704
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions cli/disk/ftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,11 @@ func (l *ftpDisk) existsWithLock(res *puddle.Resource[*ftp.ServerConn], p string
}
} else {
if errors.As(err, &protocolError) {
switch protocolError.Code {
case ftp.StatusFileUnavailable:
if protocolError.Code == ftp.StatusFileUnavailable {
return false, nil
default:
// We won't handle any other kind of error, see above.
return false, fmt.Errorf("failed to list path: %w", err)
}
}
// This is a non-protocol error, see above.
// We won't handle any other kind of error, see above.
return false, fmt.Errorf("failed to list path: %w", err)
}

Expand All @@ -168,17 +164,13 @@ func (l *ftpDisk) existsWithLock(res *puddle.Resource[*ftp.ServerConn], p string
}

if errors.As(err, &protocolError) {
switch protocolError.Code {
case ftp.StatusFileUnavailable:
if protocolError.Code == ftp.StatusFileUnavailable {
return false, nil
default:
// We won't handle any other kind of error, see above.
return false, fmt.Errorf("failed to list path: %w", err)
}
}

// This is a non-protocol error, see above.
return false, fmt.Errorf("failed to list path: %w", err)
// We won't handle any other kind of error, see above.
return false, fmt.Errorf("failed to list parent path: %w", err)
}

func (l *ftpDisk) Exists(p string) (bool, error) {
Expand Down

0 comments on commit dc83704

Please sign in to comment.