ash icon indicating copy to clipboard operation
ash copied to clipboard

misleading error message with multiple "use Ash.Domain" macro invocations.

Open at7heb opened this issue 1 year ago • 2 comments

Describe the bug I had two use Ash.Domain macro calls in my domain definition file. The error message

    error: def can?/3 defines defaults multiple times. Elixir allows defaults to be declared once per definition. Instead of:

misled me, and the indicated line was the defmodule line:

    │
  1 │ defmodule Ogl.Example do
    │ ^^^^^^^^^^^^^^^^^^^^^^^^
    │
    └─ lib/ogl/example.ex:1

To Reproduce

Ogl.Example do
  use Ash.Domain

  # In your Domain(s)
  use Ash.Domain,
    extensions: [AshAdmin.Domain]
end

Expected behavior The error message should have indicated that the second use Ash.Domain line was the problem. Runtime

 Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

IEx 1.17.3 (compiled with Erlang/OTP 27)
  • macOS Sonoma 14.6.1
  • Ash "ash": {:hex, :ash, "3.4.11", "f96d33a2f63773262dec7dae6b7af3fa998b8fd1f1ac22dbed8e49475c92fbb3", ...

Additional context Low priority -- I won't do this again.

at7heb avatar Oct 20 '24 14:10 at7heb

I can take it, if it's still relevant

mudriyjo avatar Aug 16 '25 20:08 mudriyjo

@mudriyjo please do 🙇

zachdaniel avatar Aug 18 '25 19:08 zachdaniel