-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Description
clique_error defines how to format all errors, but if I want to validate a flag is properly formed, I can't customize the output (actually I'll probably get function_clause). Example typecasting function:
ip(String) ->
try
[Ip, PortStr] = string:tokens(String, ":"),
{ok, _} = inet_parse:address(Ip),
Port = list_to_integer(PortStr),
{Ip, Port}
catch
error:badarg ->
{error, port_is_not_integer};
error:badmatch ->
{error, invalid_address}
end.I should be able to use symbolic errors in this case or handle them explicitly by running the command with flagged inputs. Currently I can do neither because clique_error is called immediately upon encountering an error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels