Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SftpEx.get_type + Access error #22

Open
Jbalcek opened this issue May 16, 2019 · 0 comments
Open

SftpEx.get_type + Access error #22

Jbalcek opened this issue May 16, 2019 · 0 comments

Comments

@Jbalcek
Copy link

Jbalcek commented May 16, 2019

Hi Mike,

First: Congrats for the good SFTP Elixir job !

  1. SftpEx.get_type doesn't return {:ok, type} when it succeed, as stated in the documentation, but only type.

  2. You should add the Access behaviour to Sftp.Connection :
    @behaviour Access

and

 # Access callbacks the easy way
  def fetch(term, key) do
    term
    |> Map.from_struct()
    |> Map.fetch(key)
  end

  def get(term, key, default) do
    term
    |> Map.from_struct()
    |> Map.get(key, default)
  end

  def get_and_update(data, key, function) do
    data
    |> Map.from_struct()
    |> Map.get_and_update(key, function)
  end

  def pop(data, key) do
    data
    |> Map.from_struct()
    |> Map.pop(key)
  end

to avoid access errors...

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant