OpenRailAssociation / osrd

An open source web application for railway infrastructure design, capacity analysis, timetabling and simulation
https://osrd.fr
436 stars 40 forks source link

core: add error details when infra couldn't be loaded #8365

Open eckter opened 1 month ago

eckter commented 1 month ago

The current situation

There was a confusion around "hard infra error" types

The original error was used in InfraManager and its only content is that the infra couldn't be loaded. "source operation" described at what step it failed. It had no other context.

Then it was also used to describe any infra error. "Source operation" was used with strings instead, with the error message.

The error in InfraManager is actually thrown any time something was thrown while loading an infra, which removes any kind of context or explanation.

Content of this PR

The two use cases have been split. The original use remains as it is.

A new error has been created for generic infra errors. It still lacks details and eventually we should have different errors for each case.

When the original error is thrown because of another exception, the original error is now included in the context.

Open questions

  1. Are "recursive errors" okay? I feel like it's better than nothing as the actual error can be seen in the response, but it's harder to display / translate
  2. If not, do we need the InfraManager to wrap everything in its own error? It seems to be used to identify "soft error" / "hard error". Could we use another method instead?
  3. Do we want to display these errors to the user in the front-end? I feel like we should as it explains infra edition issues, but we're currently very far away from doing this
codecov-commenter commented 1 month ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 5.55556% with 17 lines in your changes missing coverage. Please review.

Project coverage is 37.49%. Comparing base (3fc524d) to head (03e0082).

Files Patch % Lines
.../src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt 0.00% 11 Missing :warning:
...a/fr/sncf/osrd/reporting/exceptions/OSRDError.java 0.00% 4 Missing :warning:
...lin/fr/sncf/osrd/sim_infra/impl/RawInfraBuilder.kt 0.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #8365 +/- ## ============================================ - Coverage 37.49% 37.49% -0.01% Complexity 2163 2163 ============================================ Files 1257 1257 Lines 116563 116552 -11 Branches 3145 3145 ============================================ - Hits 43706 43697 -9 + Misses 71013 71011 -2 Partials 1844 1844 ``` | [Flag](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [core](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `74.87% <5.55%> (+0.06%)` | :arrow_up: | | [editoast](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `66.37% <ø> (-0.04%)` | :arrow_down: | | [front](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `16.69% <ø> (ø)` | | | [gateway](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `2.20% <ø> (ø)` | | | [osrdyne](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `2.71% <ø> (ø)` | | | [railjson_generator](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `87.49% <ø> (ø)` | | | [tests](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/8365/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `72.98% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.