Skip to content

Better error message for undefined variables within remote calls to macro's missing a corresponding require #13465

Open
@zachdaniel

Description

@zachdaniel

Current behavior

When calling macros like Ecto.Query, you often end up with an error message that can be cryptic, especially with beginners.

For example, the following code without adding require Ecto.Query.

Ecto.Query.from row in Table, where: row.name == "fred"

will produce error: undefined variable "row"

This should be an error, but I think that a hint here would go a long way towards helping users understand what needs to happen.

Desired behavior

In this situation, the compiler should check to see if it is within a remote call to a macro that has not been required, and if so provide a helpful message to the user, something along the lines of:

perhaps you are missing require Ecto.Query?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions