Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Dates.canonicalize in error messages #385

Merged
merged 3 commits into from
Jul 1, 2024
Merged
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
10 changes: 5 additions & 5 deletions src/system_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ with the given horizon and interval.
Throw ConflictingInputsError if any time series cannot be converted.

Return a Vector of NamedTuple of component, time series metadata, and forecast parameters
for all matches.
for all matches.
"""
function _check_transform_single_time_series(
data::SystemData,
Expand Down Expand Up @@ -620,15 +620,15 @@ function _check_single_time_series_transformed_parameters(
if desired_horizon > max_horizon
throw(
ConflictingInputsError(
"desired horizon = $desired_horizon is greater than max horizon = $max_horizon",
"TimeSeries: $(get_name(metadata)) desired horizon = $(Dates.canonicalize(desired_horizon)) is greater than max horizon = $(Dates.canonicalize(max_horizon))",
),
)
end

if desired_horizon % resolution != Dates.Millisecond(0)
throw(
ConflictingInputsError(
"desired horizon = $desired_horizon is not evenly divisible by resolution = $resolution",
"TimeSeries: $(get_name(metadata)) desired horizon = $(Dates.canonicalize(desired_horizon)) is not evenly divisible by resolution = $(Dates.canonicalize(resolution))",
),
)
end
Expand All @@ -637,11 +637,11 @@ function _check_single_time_series_transformed_parameters(
max_interval = desired_horizon
if len == horizon_count && desired_interval == max_interval
desired_interval = Dates.Second(0)
@warn "There is only one forecast window. Setting interval = $desired_interval"
@warn "There is only one forecast window. Setting interval = $(Dates.canonicalize(desired_interval))"
elseif desired_interval > max_interval
throw(
ConflictingInputsError(
"interval = $desired_interval is bigger than the max of $max_interval",
"TimeSeries: $(get_name(metadata)) interval = $(Dates.canonicalize(desired_interval)) is bigger than the max of $(Dates.canonicalize(max_interval))",
),
)
end
Expand Down
Loading