From 760783dbeccba92059b2ce796a09f9194982f2be Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Sat, 7 Dec 2024 16:05:43 -0500 Subject: [PATCH] docs: improve error handling docs --- documentation/topics/development/error-handling.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/documentation/topics/development/error-handling.md b/documentation/topics/development/error-handling.md index cc63b5308..9d2686e00 100644 --- a/documentation/topics/development/error-handling.md +++ b/documentation/topics/development/error-handling.md @@ -96,7 +96,7 @@ For example: ```elixir def change(changeset, _, _) do if some_condition(changeset) do - error = Ash.Error.Changes.Required.new( + error = Ash.Error.Changes.Required.exception( field: :foo, type: :attribute, resource: changeset.resource @@ -127,3 +127,8 @@ defmodule Ash.Error.Action.InvalidArgument do end end ``` + +## API Extensions + +AshJsonApi and AshGraphql both use a special protocol to determine how (and if) a raised or returned error should be displayed. +See [AshJsonApi.Error](https://hexdocs.pm/ash_json_api/AshJsonApi.Error.html) and [AshGraphl.Error](https://hexdocs.pm/ash_graphql/AshGraphql.Error.html)