Skip to content

Commit

Permalink
add connection error trap for list/walk funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyEnr1quez committed Oct 7, 2024
1 parent 73ff673 commit dd8dd8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (c *client) ListFiles(dir string) ([]string, error) {
pattern := filepath.Clean(strings.TrimPrefix(dir, string(os.PathSeparator)))

conn, err := c.connection()
if err != nil {
if err = c.clearConnectionOnError(err); err != nil {
return nil, err
}

Expand All @@ -458,7 +458,7 @@ func (c *client) ListFiles(dir string) ([]string, error) {
case pattern != "":
pattern = "[/?]" + pattern + "/*"
wd, err = conn.Getwd()
if err != nil {
if err = c.clearConnectionOnError(err); err != nil {
return nil, err
}
}
Expand Down Expand Up @@ -568,7 +568,7 @@ func (c *client) Walk(dir string, fn fs.WalkDirFunc) error {
defer c.mu.Unlock()

conn, err := c.connection()
if err != nil {
if err = c.clearConnectionOnError(err); err != nil {
return err
}

Expand Down

0 comments on commit dd8dd8f

Please sign in to comment.