-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: Use
Splode
for managing errors.
- Loading branch information
Showing
23 changed files
with
115 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
"backoff", | ||
"casted", | ||
"mappish", | ||
"Planable" | ||
"Planable", | ||
"splode", | ||
"Splode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
defmodule Reactor.Error do | ||
@moduledoc """ | ||
Uses `splode` to manage various classes of error. | ||
""" | ||
|
||
use Splode, | ||
error_classes: [ | ||
invalid: Reactor.Error.Invalid, | ||
reactor: Reactor.Error.Internal, | ||
unknown: Reactor.Error.Unknown | ||
], | ||
unknown_error: Reactor.Error.Unknown.Unknown | ||
end |
16 changes: 7 additions & 9 deletions
16
lib/reactor/errors/compose_error.ex → lib/reactor/errors/internal/compose.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
lib/reactor/errors/plan_error.ex → lib/reactor/errors/internal/plan.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 3 additions & 7 deletions
10
lib/reactor/errors/retries_exceeded_error.ex → ...actor/errors/internal/retries_exceeded.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule Reactor.Error.Invalid do | ||
Check warning on line 1 in lib/reactor/errors/invalid.ex GitHub Actions / ash-ci / mix credo --strict
|
||
use Splode.Error, fields: [:errors], class: :unknown | ||
|
||
def splode_message(%{errors: errors}) do | ||
Splode.ErrorClass.error_messages(errors) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
defmodule Reactor.Error.Invalid.Transform do | ||
@moduledoc """ | ||
An error which occurs when building and running transforms. | ||
""" | ||
use Splode.Error, fields: [:input, :output, :message], class: :invalid | ||
|
||
@doc false | ||
@impl true | ||
def splode_message(error), do: error.message | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule Reactor.Error.Internal do | ||
Check warning on line 1 in lib/reactor/errors/reactor.ex GitHub Actions / ash-ci / mix credo --strict
|
||
use Splode.Error, fields: [:errors], class: :reactor | ||
|
||
def splode_message(%{errors: errors}) do | ||
Splode.ErrorClass.error_messages(errors) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule Reactor.Error.Unknown do | ||
Check warning on line 1 in lib/reactor/errors/unknown.ex GitHub Actions / ash-ci / mix credo --strict
|
||
use Splode.Error, fields: [:errors], class: :unknown | ||
|
||
def splode_message(%{errors: errors}) do | ||
Splode.ErrorClass.error_messages(errors) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Reactor.Error.Unknown.Unknown do | ||
@moduledoc """ | ||
An error used to wrap unknown errors. | ||
""" | ||
|
||
use Splode.Error, fields: [:error], class: :unknown | ||
|
||
def splode_message(%{error: error}) do | ||
Exception.message(error) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters