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

Update the way Rust returns errors #623

Conversation

Jhonatannunessilva
Copy link
Contributor

This PR resolves #584

After this PR, all errors returned from Rust will be strings instead of tuples

- After this change, all errors returned from Rust will be strings instead of tuples
@Jhonatannunessilva Jhonatannunessilva force-pushed the update-the-way-rust-returns-errors branch from b1abdd9 to c52b8ff Compare June 18, 2023 15:06
@@ -149,7 +149,7 @@ defmodule Explorer.PolarsBackend.Shared do
def internal_from_dtype(:integer), do: "i64"
def internal_from_dtype(:string), do: "str"

defp error_message({_err_type, error}) when is_binary(error), do: error
defp error_message(error) when is_binary(error), do: error
defp error_message(error), do: inspect(error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this branch ever be called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but if I remove this branch the function will be:

defp error_message(error), do: error

So is it better to remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the branch but keep the guard in the previous one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philss philss merged commit 4280146 into elixir-explorer:main Jun 18, 2023
@philss
Copy link
Member

philss commented Jun 18, 2023

yey! 🎉
thank you, @Jhonatannunessilva! 💜

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

Successfully merging this pull request may close these issues.

Return {:error, string} instead of {:error, {:polars, string()}}
3 participants