Skip to content

Commit d59ff34

Browse files
committed
core: cleanup error types and fix some causes
1 parent 087973a commit d59ff34

File tree

3 files changed

+7
-97
lines changed

3 files changed

+7
-97
lines changed

core/osrd-reporting/src/main/java/fr/sncf/osrd/reporting/exceptions/ErrorType.java

+7-25
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ public enum ErrorType {
5858
InfraLoadingCacheException(
5959
"infra_loading:cache_exception",
6060
"cached exception",
61-
ErrorCause.USER
61+
ErrorCause.INTERNAL
6262
),
6363
InfraLoadingInvalidStatusException(
6464
"infra_loading:invalid_status",
6565
"Status doesn’t exist",
66-
ErrorCause.USER
66+
ErrorCause.INTERNAL
6767
),
6868
InfraInvalidStatusWhileWaitingStable(
6969
"infra_loading:invalid_status_waiting_stable",
7070
"invalid status after waitUntilStable",
71-
ErrorCause.USER
71+
ErrorCause.INTERNAL
7272
),
7373
InfraNotLoadedException(
7474
"infra:not_loaded",
@@ -105,11 +105,6 @@ public enum ErrorType {
105105
"Missing detectors on route (expected at least 2)",
106106
ErrorCause.USER
107107
),
108-
InvalidInfraEndpointAlreadyLinked(
109-
"invalid_infra:endpoint_already_linked",
110-
"Error in track link: at least one endpoint is already linked",
111-
ErrorCause.USER
112-
),
113108
InvalidInfraTrackSlopeWithInvalidRange(
114109
"invalid_infra:track_slope_invalid_range",
115110
"Track has a slope with an invalid range",
@@ -236,18 +231,6 @@ public enum ErrorType {
236231
"Offset %s is not contained in the track ranges view",
237232
ErrorCause.USER
238233
),
239-
240-
InvalidRouteNoOffset(
241-
"invalid_route",
242-
"Couldn't find offset on route",
243-
ErrorCause.USER
244-
),
245-
246-
InvalidPathError(
247-
"invalid_path",
248-
"Detector offsets must be strictly increasing",
249-
ErrorCause.USER
250-
),
251234
UnknownRollingStock(
252235
"unknown_stock",
253236
"unknown rolling stock",
@@ -296,12 +279,12 @@ public enum ErrorType {
296279
EnvelopePartsNotContiguous(
297280
"envelope_error",
298281
"invalid envelope, envelope parts are not contiguous",
299-
ErrorCause.USER
282+
ErrorCause.INTERNAL
300283
),
301284
NoCompatibleEnvelopeFound(
302285
"no_compatible_envelope",
303286
"Couldn't find an envelope that wouldn't cause a conflict",
304-
ErrorCause.USER
287+
ErrorCause.INTERNAL
305288
),
306289
SignalingError(
307290
"signaling_error",
@@ -318,16 +301,15 @@ public enum ErrorType {
318301
"unknown sig schema field",
319302
ErrorCause.USER
320303
),
321-
322304
InvalidSTDCMDelayError(
323305
"invalid_stdcm",
324306
"STDCM lookahead isn't supported yet",
325-
ErrorCause.USER
307+
ErrorCause.INTERNAL
326308
),
327309
InvalidSTDCMUnspecifiedStartTime(
328310
"invalid_stdcm",
329311
"STDCM requests with unspecified start time are not supported yet",
330-
ErrorCause.USER
312+
ErrorCause.INTERNAL
331313
),
332314
InvalidSTDCMUnspecifiedStartAndEndTime(
333315
"invalid_stdcm",

core/osrd-reporting/src/main/java/fr/sncf/osrd/reporting/exceptions/OSRDError.java

-52
Original file line numberDiff line numberDiff line change
@@ -195,41 +195,6 @@ public static OSRDError newMissingRollingStockFieldError(
195195
return error;
196196
}
197197

198-
/**
199-
* Creates a new OSRDError for an invalid schedule error with a track section.
200-
*
201-
* @param errorType the error type
202-
* @param trackSection the track section associated with the error
203-
* @return a new OSRDError instance
204-
*/
205-
public static OSRDError newInvalidScheduleError(
206-
ErrorType errorType,
207-
String trackSection
208-
) {
209-
var error = new OSRDError(errorType);
210-
error.context.put("track_section", trackSection);
211-
return error;
212-
}
213-
214-
/**
215-
* Creates a new OSRDError for an invalid schedule error with a route and route signaling type.
216-
*
217-
* @param errorType the error type
218-
* @param route the route associated with the error
219-
* @param routeSignalingType the route signaling type
220-
* @return a new OSRDError instance
221-
*/
222-
public static OSRDError newInvalidScheduleError(
223-
ErrorType errorType,
224-
String route,
225-
String routeSignalingType
226-
) {
227-
var error = new OSRDError(errorType);
228-
error.context.put("route", route);
229-
error.context.put("route_signaling_type", routeSignalingType);
230-
return error;
231-
}
232-
233198
/**
234199
* Creates a new OSRDError for an invalid track range error with an offset.
235200
*
@@ -244,23 +209,6 @@ public static OSRDError newInvalidTrackRangeError(
244209
return error;
245210
}
246211

247-
/**
248-
* Creates a new OSRDError for an invalid path error with previous and current detectors.
249-
*
250-
* @param previousDetector the previous detector
251-
* @param detector the current detector
252-
* @return a new OSRDError instance
253-
*/
254-
public static OSRDError newInvalidPathError(
255-
Object previousDetector,
256-
Object detector
257-
) {
258-
var error = new OSRDError(ErrorType.InvalidPathError);
259-
error.context.put("previous_detector", previousDetector);
260-
error.context.put("detector", detector);
261-
return error;
262-
}
263-
264212
/**
265213
* Creates a new OSRDError for an unknown rolling stock error with a rolling stock ID.
266214
*

core/src/main/java/fr/sncf/osrd/infra/implementation/tracks/undirected/UndirectedInfraBuilder.java

-20
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,6 @@ public static OSRDError newInvalidRangeError(ErrorType errorType, String id) {
9595
return error;
9696
}
9797

98-
/**
99-
* Creates a new OSRDError for an invalid infrastructure error with a link ID and source/destination nodes.
100-
*
101-
* @param linkID the link ID associated with the error
102-
* @param sourceNode the source node
103-
* @param destinationNode the destination node
104-
* @return a new OSRDError instance
105-
*/
106-
public static OSRDError newEndpointAlreadyLinkedError(
107-
String linkID,
108-
Object sourceNode,
109-
Object destinationNode
110-
) {
111-
var error = new OSRDError(ErrorType.InvalidInfraEndpointAlreadyLinked);
112-
error.context.put("link_id", linkID);
113-
error.context.put("source_node", sourceNode);
114-
error.context.put("destination_node", destinationNode);
115-
return error;
116-
}
117-
11898
/**
11999
* Creates a new OSRDError for an invalid infrastructure error with an RJS switch ID, switch type, and switch ports.
120100
*

0 commit comments

Comments
 (0)