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

chore: Report which module is at fault, when raising an error about relationship domain inclusion #1384

Conversation

sevenseacat
Copy link
Contributor

My app is an Ash 2 app but the error is the same (s/api/domain/)

When an error is raised about resources not being included in the same API, the error didn't actually tell you what module it was coming from:

** (EXIT from #PID<0.98.0>) an exception was raised:
    ** (RuntimeError) Resource `MyApp.Location` in relationship `:location` is not in api `MyApp.Schematics`. Please do one of the following

1. add the resource to the api `MyApp.Schematics`
2. configure a different api

        (ash 2.21.15) lib/ash/api/verifiers/validate_related_resource_inclusion.ex:67: anonymous fn/4 in Ash.Api.Verifiers.ValidateRelatedResourceInclusion.verify/1
        (elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
        (ash 2.21.15) lib/ash/api/verifiers/validate_related_resource_inclusion.ex:16: anonymous fn/4 in Ash.Api.Verifiers.ValidateRelatedResourceInclusion.verify/1
        (elixir 1.15.4) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
        (ash 2.21.15) lib/ash/api/verifiers/validate_related_resource_inclusion.ex:15: Ash.Api.Verifiers.ValidateRelatedResourceInclusion.verify/1
        lib/myapp/schematics/schematics.ex:1: anonymous fn/1 in MyApp.Schematics.__verify_spark_dsl__/1
        (elixir 1.15.4) lib/enum.ex:984: Enum."-each/2-lists^foreach/1-0-"/2
        lib/myapp/schematics/schematics.ex:1: MyApp.Schematics.__verify_spark_dsl__/1

By adding the source module name to the error message, now you know where to look!

Contributor checklist

  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@zachdaniel zachdaniel merged commit 074b65e into ash-project:main Aug 12, 2024
30 checks passed
@zachdaniel
Copy link
Contributor

🚀 Thank you for your contribution! 🚀

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