From cd6a7cae695d714a681c2b612cd9d0625cede556 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Wed, 11 Oct 2023 16:26:48 -0400 Subject: [PATCH] fix: don't raise all errors --- .../dsls/DSL:-AshPostgres.DataLayer.cheatmd | 122 +++++++++++++----- lib/data_layer.ex | 2 +- 2 files changed, 88 insertions(+), 36 deletions(-) diff --git a/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd b/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd index 4652e44..736f48f 100644 --- a/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd +++ b/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd @@ -401,8 +401,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE" - -### Options +### Arguments @@ -416,7 +415,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE" - + +
- + fields @@ -434,9 +433,23 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
+### Options + + + + + + + + + + + +
NameTypeDefaultDocs
- + name @@ -456,7 +469,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + unique @@ -476,7 +489,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + concurrently @@ -496,7 +509,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + using @@ -516,7 +529,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + prefix @@ -536,7 +549,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + where @@ -556,7 +569,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + message @@ -576,7 +589,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
- + include @@ -661,8 +674,7 @@ end - -### Options +### Arguments @@ -676,7 +688,7 @@ end - + +
- + name @@ -696,9 +708,23 @@ end
+### Options + + + + + + + + + + + +
NameTypeDefaultDocs
- + up @@ -720,7 +746,7 @@ end
- + down @@ -741,7 +767,7 @@ end
- + code? @@ -994,8 +1020,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post - -### Options +### Arguments @@ -1009,7 +1034,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post - + +
- + relationship @@ -1028,9 +1053,23 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
+### Options + + + + + + + + + + + +
NameTypeDefaultDocs
- + ignore? @@ -1050,7 +1089,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
- + on_delete @@ -1071,7 +1110,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
- + on_update @@ -1092,7 +1131,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
- + deferrable @@ -1113,7 +1152,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
- + name @@ -1189,8 +1228,7 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message: - -### Options +### Arguments @@ -1204,7 +1242,7 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message: - + +
- + attribute @@ -1225,7 +1263,7 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
- + name @@ -1244,9 +1282,23 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
+### Options + + + + + + + + + + + +
NameTypeDefaultDocs
- + message @@ -1266,7 +1318,7 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
- + check diff --git a/lib/data_layer.ex b/lib/data_layer.ex index 7e51578..b786337 100644 --- a/lib/data_layer.ex +++ b/lib/data_layer.ex @@ -1561,7 +1561,7 @@ defmodule AshPostgres.DataLayer do end defp handle_raised_error(error, stacktrace, _ecto_changeset, _resource) do - reraise Ash.Error.to_error_class(error, stacktrace), stacktrace + {:error, Ash.Error.to_ash_error(error, stacktrace)} end defp constraints_to_errors(%{constraints: user_constraints} = changeset, action, constraints) do