Skip to content

Return better error tuples (avoid string reason) #71

@pmeinhardt

Description

@pmeinhardt

In some cases, we're currently returning {:error, "binary with error message…"} tuples, which may complicate proper error handling because the binary message is harder to match against.

Instead, we should return structured error tuples, e.g.

{:error, {:interrupted, status}}

# …instead of
{:error, "SCP exited before completing the transfer (#{status})"}

lib/sshkit/scp/download.ex:170

See also http://michal.muskala.eu/2017/02/10/error-handling-in-elixir-libraries.html#okerror-tuples.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions