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

feat: add better errors for invalid compiler configurations #1575

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

polvalente
Copy link
Contributor

Sometimes, users will try to use invalid combos such as using Torchx as a defn compiler.
This PR transforms the generic FunctionClauseError into a more actionable message.

@polvalente polvalente self-assigned this Jan 28, 2025
defp raise_missing_callback(exception, name, arity, stacktrace) do
case exception do
%UndefinedFunctionError{module: compiler, function: ^name, arity: ^arity} ->
raise ArgumentError,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@josevalim I used ArgumentError because this is directly caused by an invalid option being passed. If you have another suggestion for the exception type, I'm open to it!

nx/lib/nx/serving.ex Outdated Show resolved Hide resolved
@polvalente polvalente merged commit aa366da into main Jan 30, 2025
8 checks passed
@polvalente polvalente deleted the pv-docs/improve-errors-for-missing-callbacks branch January 30, 2025 16:30
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.

2 participants