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

core: cleanup error types and fix some causes #5331

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ public enum ErrorType {
InfraLoadingCacheException(
"infra_loading:cache_exception",
"cached exception",
ErrorCause.USER
ErrorCause.INTERNAL
),
InfraLoadingInvalidStatusException(
"infra_loading:invalid_status",
"Status doesn’t exist",
ErrorCause.USER
ErrorCause.INTERNAL
),
InfraInvalidStatusWhileWaitingStable(
"infra_loading:invalid_status_waiting_stable",
"invalid status after waitUntilStable",
ErrorCause.USER
ErrorCause.INTERNAL
),
InfraNotLoadedException(
"infra:not_loaded",
Expand Down Expand Up @@ -105,11 +105,6 @@ public enum ErrorType {
"Missing detectors on route (expected at least 2)",
ErrorCause.USER
),
InvalidInfraEndpointAlreadyLinked(
"invalid_infra:endpoint_already_linked",
"Error in track link: at least one endpoint is already linked",
ErrorCause.USER
),
InvalidInfraTrackSlopeWithInvalidRange(
"invalid_infra:track_slope_invalid_range",
"Track has a slope with an invalid range",
Expand Down Expand Up @@ -236,18 +231,6 @@ public enum ErrorType {
"Offset %s is not contained in the track ranges view",
ErrorCause.USER
),

InvalidRouteNoOffset(
"invalid_route",
"Couldn't find offset on route",
ErrorCause.USER
),

InvalidPathError(
"invalid_path",
"Detector offsets must be strictly increasing",
ErrorCause.USER
),
UnknownRollingStock(
"unknown_stock",
"unknown rolling stock",
Expand Down Expand Up @@ -296,7 +279,7 @@ public enum ErrorType {
EnvelopePartsNotContiguous(
"envelope_error",
"invalid envelope, envelope parts are not contiguous",
ErrorCause.USER
ErrorCause.INTERNAL
),
SignalingError(
"signaling_error",
Expand All @@ -313,16 +296,15 @@ public enum ErrorType {
"unknown sig schema field",
ErrorCause.USER
),

InvalidSTDCMDelayError(
"invalid_stdcm",
"STDCM lookahead isn't supported yet",
ErrorCause.USER
ErrorCause.INTERNAL
),
InvalidSTDCMUnspecifiedStartTime(
"invalid_stdcm",
"STDCM requests with unspecified start time are not supported yet",
ErrorCause.USER
ErrorCause.INTERNAL
),
InvalidSTDCMUnspecifiedStartAndEndTime(
"invalid_stdcm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,41 +195,6 @@ public static OSRDError newMissingRollingStockFieldError(
return error;
}

/**
* Creates a new OSRDError for an invalid schedule error with a track section.
*
* @param errorType the error type
* @param trackSection the track section associated with the error
* @return a new OSRDError instance
*/
public static OSRDError newInvalidScheduleError(
ErrorType errorType,
String trackSection
) {
var error = new OSRDError(errorType);
error.context.put("track_section", trackSection);
return error;
}

/**
* Creates a new OSRDError for an invalid schedule error with a route and route signaling type.
*
* @param errorType the error type
* @param route the route associated with the error
* @param routeSignalingType the route signaling type
* @return a new OSRDError instance
*/
public static OSRDError newInvalidScheduleError(
ErrorType errorType,
String route,
String routeSignalingType
) {
var error = new OSRDError(errorType);
error.context.put("route", route);
error.context.put("route_signaling_type", routeSignalingType);
return error;
}

/**
* Creates a new OSRDError for an invalid track range error with an offset.
*
Expand All @@ -244,23 +209,6 @@ public static OSRDError newInvalidTrackRangeError(
return error;
}

/**
* Creates a new OSRDError for an invalid path error with previous and current detectors.
*
* @param previousDetector the previous detector
* @param detector the current detector
* @return a new OSRDError instance
*/
public static OSRDError newInvalidPathError(
Object previousDetector,
Object detector
) {
var error = new OSRDError(ErrorType.InvalidPathError);
error.context.put("previous_detector", previousDetector);
error.context.put("detector", detector);
return error;
}

/**
* Creates a new OSRDError for an unknown rolling stock error with a rolling stock ID.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,6 @@ public static OSRDError newInvalidRangeError(ErrorType errorType, String id) {
return error;
}

/**
* Creates a new OSRDError for an invalid infrastructure error with a link ID and source/destination nodes.
*
* @param linkID the link ID associated with the error
* @param sourceNode the source node
* @param destinationNode the destination node
* @return a new OSRDError instance
*/
public static OSRDError newEndpointAlreadyLinkedError(
String linkID,
Object sourceNode,
Object destinationNode
) {
var error = new OSRDError(ErrorType.InvalidInfraEndpointAlreadyLinked);
error.context.put("link_id", linkID);
error.context.put("source_node", sourceNode);
error.context.put("destination_node", destinationNode);
return error;
}

/**
* Creates a new OSRDError for an invalid infrastructure error with an RJS switch ID, switch type, and switch ports.
*
Expand Down