Current section
Files
Jump to
Current section
Files
src/tempo@error.erl
-module(tempo@error).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-define(FILEPATH, "src/tempo/error.gleam").
-export([describe_datetime_parse_error/1, describe_datetime_out_of_bounds_error/1, describe_offset_parse_error/1, describe_naive_datetime_parse_error/1, describe_date_parse_error/1, describe_date_out_of_bounds_error/1, describe_time_parse_error/1, describe_time_out_of_bounds_error/1]).
-export_type([date_time_parse_error/0, date_time_out_of_bounds_error/0, offset_parse_error/0, naive_date_time_parse_error/0, date_parse_error/0, date_out_of_bounds_error/0, time_parse_error/0, time_out_of_bounds_error/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-type date_time_parse_error() :: {date_time_invalid_format, binary()} |
{date_time_date_parse_error, binary(), date_parse_error()} |
{date_time_time_parse_error, binary(), time_parse_error()} |
{date_time_offset_parse_error, binary(), offset_parse_error()}.
-type date_time_out_of_bounds_error() :: {date_time_date_out_of_bounds,
binary(),
date_out_of_bounds_error()} |
{date_time_time_out_of_bounds, binary(), time_out_of_bounds_error()} |
{date_time_offset_out_of_bounds, binary()}.
-type offset_parse_error() :: {offset_invalid_format, binary()} |
{offset_out_of_bounds, binary()}.
-type naive_date_time_parse_error() :: {naive_date_time_invalid_format,
binary()} |
{naive_date_time_date_parse_error, binary(), date_parse_error()} |
{naive_date_time_time_parse_error, binary(), time_parse_error()}.
-type date_parse_error() :: {date_invalid_format, binary()} |
{date_out_of_bounds, binary(), date_out_of_bounds_error()}.
-type date_out_of_bounds_error() :: {date_day_out_of_bounds, binary()} |
{date_month_out_of_bounds, binary()} |
{date_year_out_of_bounds, binary()}.
-type time_parse_error() :: {time_invalid_format, binary()} |
{time_out_of_bounds, binary(), time_out_of_bounds_error()}.
-type time_out_of_bounds_error() :: {time_hour_out_of_bounds, binary()} |
{time_minute_out_of_bounds, binary()} |
{time_second_out_of_bounds, binary()} |
{time_micro_second_out_of_bounds, binary()}.
-file("src/tempo/error.gleam", 9).
?DOC(false).
-spec describe_datetime_parse_error(date_time_parse_error()) -> binary().
describe_datetime_parse_error(Error) ->
case Error of
{date_time_invalid_format, Input} ->
<<<<"Invalid datetime format: \""/utf8, Input/binary>>/binary,
"\""/utf8>>;
{date_time_date_parse_error, Input@1, {date_invalid_format, _}} ->
<<<<"Invalid date format in datetime: \""/utf8, Input@1/binary>>/binary,
"\""/utf8>>;
{date_time_date_parse_error,
Input@2,
{date_out_of_bounds, _, {date_day_out_of_bounds, _}}} ->
<<<<"Day out of bounds in datetime: \""/utf8, Input@2/binary>>/binary,
"\""/utf8>>;
{date_time_date_parse_error,
Input@3,
{date_out_of_bounds, _, {date_month_out_of_bounds, _}}} ->
<<<<"Month out of bounds in datetime: \""/utf8, Input@3/binary>>/binary,
"\""/utf8>>;
{date_time_date_parse_error,
Input@4,
{date_out_of_bounds, _, {date_year_out_of_bounds, _}}} ->
<<<<"Year out of bounds in datetime: \""/utf8, Input@4/binary>>/binary,
"\""/utf8>>;
{date_time_time_parse_error, Input@5, {time_invalid_format, _}} ->
<<<<"Invalid time format in datetime: \""/utf8, Input@5/binary>>/binary,
"\""/utf8>>;
{date_time_time_parse_error,
Input@6,
{time_out_of_bounds, _, {time_hour_out_of_bounds, _}}} ->
<<<<"Hour out of bounds in datetime: \""/utf8, Input@6/binary>>/binary,
"\""/utf8>>;
{date_time_time_parse_error,
Input@7,
{time_out_of_bounds, _, {time_minute_out_of_bounds, _}}} ->
<<<<"Minute out of bounds in datetime: \""/utf8, Input@7/binary>>/binary,
"\""/utf8>>;
{date_time_time_parse_error,
Input@8,
{time_out_of_bounds, _, {time_second_out_of_bounds, _}}} ->
<<<<"Second out of bounds in datetime: \""/utf8, Input@8/binary>>/binary,
"\""/utf8>>;
{date_time_time_parse_error,
Input@9,
{time_out_of_bounds, _, {time_micro_second_out_of_bounds, _}}} ->
<<<<"Subsecond value out of bounds in datetime: \""/utf8,
Input@9/binary>>/binary,
"\""/utf8>>;
{date_time_offset_parse_error, Input@10, {offset_invalid_format, _}} ->
<<<<"Invalid offset format in datetime: \""/utf8, Input@10/binary>>/binary,
"\""/utf8>>;
{date_time_offset_parse_error, Input@11, {offset_out_of_bounds, _}} ->
<<<<"Offset out of bounds in datetime: \""/utf8, Input@11/binary>>/binary,
"\""/utf8>>
end.
-file("src/tempo/error.gleam", 47).
?DOC(false).
-spec describe_datetime_out_of_bounds_error(date_time_out_of_bounds_error()) -> binary().
describe_datetime_out_of_bounds_error(Error) ->
case Error of
{date_time_date_out_of_bounds, Input, {date_day_out_of_bounds, _}} ->
<<"Day out of bounds in datetime: "/utf8, Input/binary>>;
{date_time_date_out_of_bounds, Input@1, {date_month_out_of_bounds, _}} ->
<<"Month out of bounds in datetime: "/utf8, Input@1/binary>>;
{date_time_date_out_of_bounds, Input@2, {date_year_out_of_bounds, _}} ->
<<"Year out of bounds in datetime: "/utf8, Input@2/binary>>;
{date_time_time_out_of_bounds, Input@3, {time_hour_out_of_bounds, _}} ->
<<"Hour out of bounds in datetime: "/utf8, Input@3/binary>>;
{date_time_time_out_of_bounds, Input@4, {time_minute_out_of_bounds, _}} ->
<<"Minute out of bounds in datetime: "/utf8, Input@4/binary>>;
{date_time_time_out_of_bounds, Input@5, {time_second_out_of_bounds, _}} ->
<<"Second out of bounds in datetime: "/utf8, Input@5/binary>>;
{date_time_time_out_of_bounds,
Input@6,
{time_micro_second_out_of_bounds, _}} ->
<<"Subsecond value out of bounds in datetime: "/utf8,
Input@6/binary>>;
{date_time_offset_out_of_bounds, Input@7} ->
<<"Offset out of bounds in datetime: "/utf8, Input@7/binary>>
end.
-file("src/tempo/error.gleam", 76).
?DOC(false).
-spec describe_offset_parse_error(offset_parse_error()) -> binary().
describe_offset_parse_error(Error) ->
case Error of
{offset_invalid_format, Input} ->
<<<<"Invalid offset format: \""/utf8, Input/binary>>/binary,
"\""/utf8>>;
{offset_out_of_bounds, Input@1} ->
<<<<"Offset out of bounds: \""/utf8, Input@1/binary>>/binary,
"\""/utf8>>
end.
-file("src/tempo/error.gleam", 90).
?DOC(false).
-spec describe_naive_datetime_parse_error(naive_date_time_parse_error()) -> binary().
describe_naive_datetime_parse_error(Error) ->
case Error of
{naive_date_time_invalid_format, Input} ->
<<<<"Invalid naive datetime format: \""/utf8, Input/binary>>/binary,
"\""/utf8>>;
{naive_date_time_date_parse_error, Input@1, {date_invalid_format, _}} ->
<<<<"Invalid date format in naive datetime: \""/utf8,
Input@1/binary>>/binary,
"\""/utf8>>;
{naive_date_time_date_parse_error,
Input@2,
{date_out_of_bounds, _, {date_day_out_of_bounds, _}}} ->
<<<<"Day out of bounds in naive datetime: \""/utf8, Input@2/binary>>/binary,
"\""/utf8>>;
{naive_date_time_date_parse_error,
Input@3,
{date_out_of_bounds, _, {date_month_out_of_bounds, _}}} ->
<<<<"Month out of bounds in naive datetime: \""/utf8,
Input@3/binary>>/binary,
"\""/utf8>>;
{naive_date_time_date_parse_error,
Input@4,
{date_out_of_bounds, _, {date_year_out_of_bounds, _}}} ->
<<<<"Year out of bounds in naive datetime: \""/utf8,
Input@4/binary>>/binary,
"\""/utf8>>;
{naive_date_time_time_parse_error, Input@5, {time_invalid_format, _}} ->
<<<<"Invalid time format in naive datetime: \""/utf8,
Input@5/binary>>/binary,
"\""/utf8>>;
{naive_date_time_time_parse_error,
Input@6,
{time_out_of_bounds, _, {time_hour_out_of_bounds, _}}} ->
<<<<"Hour out of bounds in naive datetime: \""/utf8,
Input@6/binary>>/binary,
"\""/utf8>>;
{naive_date_time_time_parse_error,
Input@7,
{time_out_of_bounds, _, {time_minute_out_of_bounds, _}}} ->
<<<<"Minute out of bounds in naive datetime: \""/utf8,
Input@7/binary>>/binary,
"\""/utf8>>;
{naive_date_time_time_parse_error,
Input@8,
{time_out_of_bounds, _, {time_second_out_of_bounds, _}}} ->
<<<<"Second out of bounds in naive datetime: \""/utf8,
Input@8/binary>>/binary,
"\""/utf8>>;
{naive_date_time_time_parse_error,
Input@9,
{time_out_of_bounds, _, {time_micro_second_out_of_bounds, _}}} ->
<<<<"Subsecond value out of bounds in naive datetime: \""/utf8,
Input@9/binary>>/binary,
"\""/utf8>>
end.
-file("src/tempo/error.gleam", 137).
?DOC(false).
-spec describe_date_parse_error(date_parse_error()) -> binary().
describe_date_parse_error(Error) ->
case Error of
{date_invalid_format, Input} ->
<<"Invalid date format: "/utf8, Input/binary>>;
{date_out_of_bounds, Input@1, {date_day_out_of_bounds, _}} ->
<<<<"Day out of bounds in date: \""/utf8, Input@1/binary>>/binary,
"\""/utf8>>;
{date_out_of_bounds, Input@2, {date_month_out_of_bounds, _}} ->
<<<<"Month out of bounds in date: \""/utf8, Input@2/binary>>/binary,
"\""/utf8>>;
{date_out_of_bounds, Input@3, {date_year_out_of_bounds, _}} ->
<<<<"Year out of bounds in date: \""/utf8, Input@3/binary>>/binary,
"\""/utf8>>
end.
-file("src/tempo/error.gleam", 156).
?DOC(false).
-spec describe_date_out_of_bounds_error(date_out_of_bounds_error()) -> binary().
describe_date_out_of_bounds_error(Error) ->
case Error of
{date_day_out_of_bounds, Input} ->
<<"Day out of bounds in date: "/utf8, Input/binary>>;
{date_month_out_of_bounds, Input@1} ->
<<"Month out of bounds in date: "/utf8, Input@1/binary>>;
{date_year_out_of_bounds, Input@2} ->
<<"Year out of bounds in date: "/utf8, Input@2/binary>>
end.
-file("src/tempo/error.gleam", 170).
?DOC(false).
-spec describe_time_parse_error(time_parse_error()) -> binary().
describe_time_parse_error(Error) ->
case Error of
{time_invalid_format, Input} ->
<<<<"Invalid time format: \""/utf8, Input/binary>>/binary,
"\""/utf8>>;
{time_out_of_bounds, Input@1, {time_hour_out_of_bounds, _}} ->
<<<<"Hour out of bounds in time: \""/utf8, Input@1/binary>>/binary,
"\""/utf8>>;
{time_out_of_bounds, Input@2, {time_minute_out_of_bounds, _}} ->
<<<<"Minute out of bounds in time: \""/utf8, Input@2/binary>>/binary,
"\""/utf8>>;
{time_out_of_bounds, Input@3, {time_second_out_of_bounds, _}} ->
<<<<"Second out of bounds in time: \""/utf8, Input@3/binary>>/binary,
"\""/utf8>>;
{time_out_of_bounds, Input@4, {time_micro_second_out_of_bounds, _}} ->
<<<<"Subsecond value out of bounds in time: \""/utf8,
Input@4/binary>>/binary,
"\""/utf8>>
end.
-file("src/tempo/error.gleam", 192).
?DOC(false).
-spec describe_time_out_of_bounds_error(time_out_of_bounds_error()) -> binary().
describe_time_out_of_bounds_error(Error) ->
case Error of
{time_hour_out_of_bounds, Input} ->
<<"Hour out of bounds in time: "/utf8, Input/binary>>;
{time_minute_out_of_bounds, Input@1} ->
<<"Minute out of bounds in time: "/utf8, Input@1/binary>>;
{time_second_out_of_bounds, Input@2} ->
<<"Second out of bounds in time: "/utf8, Input@2/binary>>;
{time_micro_second_out_of_bounds, Input@3} ->
<<"Subsecond value out of bounds in time: "/utf8, Input@3/binary>>
end.