mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
Improve error messages when adding a non-valid source URL (#436)
This commit is contained in:
parent
6a1b7b0160
commit
108a141c65
4 changed files with 21 additions and 2 deletions
|
|
@ -186,7 +186,13 @@ defmodule Pinchflat.Sources do
|
|||
{:ok, source_details} ->
|
||||
add_source_details_by_collection_type(source, changeset, source_details)
|
||||
|
||||
{:error, runner_error, _status_code} ->
|
||||
err ->
|
||||
runner_error =
|
||||
case err do
|
||||
{:error, error_msg, _status_code} -> error_msg
|
||||
{:error, error_msg} -> error_msg
|
||||
end
|
||||
|
||||
Ecto.Changeset.add_error(
|
||||
changeset,
|
||||
:original_url,
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ defmodule Pinchflat.YtDlp.MediaCollection do
|
|||
{:ok, parsed_json} <- Phoenix.json_library().decode(output) do
|
||||
{:ok, format_source_details(parsed_json)}
|
||||
else
|
||||
{:error, %Jason.DecodeError{}} -> {:error, "Error decoding JSON response"}
|
||||
err -> err
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue