Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/lightning/runs/handlers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ defmodule Lightning.Runs.Handlers do
end
end

# Error types a worker can report on a finished run.
@known_error_types ~w(
UserError RuntimeError RuntimeCrash CompileError AdaptorError
TimeoutError OOMError Lost LostAfterStart
)

def new(params) do
%__MODULE__{}
|> cast(params, [
Expand All @@ -125,6 +131,7 @@ defmodule Lightning.Runs.Handlers do
:final_state,
:timestamp
])
|> validate_inclusion(:error_type, @known_error_types)
|> put_new_change(:timestamp, Lightning.current_time())
|> then(fn changeset ->
if reason = get_change(changeset, :reason) do
Expand Down
Loading