Skip to content

Improve error handling in TransmodelGraph - #5192

Merged
t2gran merged 10 commits into
opentripplanner:dev-2.xfrom
entur:otp2_remove_system_error
Jul 24, 2023
Merged

t2gran merged 10 commits into
opentripplanner:dev-2.xfrom
entur:otp2_remove_system_error

Conversation

@t2gran

@t2gran t2gran commented Jun 15, 2023

Copy link
Copy Markdown
Member

Summary

This PR cleanup the error handling in TransmodelGraph. Uncaught exceptions, witch before propagated to the Jersey Exception filter are now caught in the TransmodelGraph#executeGraphQL method. I also removed one "layer" in the result chain. The TransmodelGraph now return a jakarta Response, not an OtpExecutionResult. This is not 100% pure, but we are not likely to support another protocol than HTTP in the near future, it is also easy to revert.

This is based on #5189

Issue

No issue.

Unit tests

New test on result mapper added.

Documentation

JavaDoc only

Changelog

No

Bumping the serialization version id

No

@t2gran t2gran added !Improvement A functional improvement or micro feature +Sandbox This will be implemented as a Sandbox feature !Technical Debt Improve code quality, no functional changes. labels Jun 15, 2023
@t2gran t2gran added this to the 2.4 (next release) milestone Jun 15, 2023
@t2gran
t2gran requested a review from a team as a code owner June 15, 2023 10:03
@t2gran
t2gran marked this pull request as draft June 15, 2023 10:03
@t2gran t2gran changed the title Otp2 remove system error Improve error handling in TransmodelGraph Jun 15, 2023
@t2gran

t2gran commented Jun 15, 2023

Copy link
Copy Markdown
Member Author

Remove Error codes from Legacy Schema

@t2gran
t2gran force-pushed the otp2_remove_system_error branch from db07f74 to dfb5388 Compare July 18, 2023 12:39
@t2gran
t2gran marked this pull request as ready for review July 18, 2023 12:39
@t2gran
t2gran requested a review from vpaturet July 18, 2023 12:40
@leonardehrenfried

Copy link
Copy Markdown
Member

The node download is timing out again. I'm hopefully fixing it with this commit: 465aca1

@leonardehrenfried
leonardehrenfried self-requested a review July 19, 2023 07:49
case WALKING_BETTER_THAN_TRANSIT:
api = new PlannerError(Message.TOO_CLOSE);
break;
case SYSTEM_ERROR:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SYSTEM_ERROR is not returned, it is handled by the GraphQL framework and reported in the errors section of the root response - if we does not know what happen, then we should not return a partial result either - it might be corrupt.

@t2gran
t2gran requested a review from leonardehrenfried July 21, 2023 11:59
@codecov

codecov Bot commented Jul 21, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 34.00% and project coverage change: +0.11 🎉

Comparison is base (0b476db) 65.69% compared to head (6dd1380) 65.80%.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5192      +/-   ##
=============================================
+ Coverage      65.69%   65.80%   +0.11%     
- Complexity     14723    14741      +18     
=============================================
  Files           1770     1767       -3     
  Lines          68556    68525      -31     
  Branches        7288     7282       -6     
=============================================
+ Hits           45037    45094      +57     
+ Misses         21025    20942      -83     
+ Partials        2494     2489       -5     
Impacted Files Coverage Δ
...entripplanner/ext/gtfsgraphqlapi/GraphQLUtils.java 25.00% <ø> (+0.43%) ⬆️
...ner/ext/gtfsgraphqlapi/generated/GraphQLTypes.java 9.17% <ø> (+<0.01%) ⬆️
...entripplanner/ext/transmodelapi/TransmodelAPI.java 0.00% <0.00%> (ø)
...tripplanner/ext/transmodelapi/TransmodelGraph.java 0.00% <0.00%> (ø)
...er/ext/transmodelapi/TransmodelGraphQLPlanner.java 0.00% <ø> (ø)
...tripplanner/ext/transmodelapi/model/EnumTypes.java 99.27% <ø> (-0.01%) ⬇️
...elapi/support/AbortOnTimeoutExecutionStrategy.java 0.00% <0.00%> (ø)
...opentripplanner/api/common/OTPExceptionMapper.java 0.00% <0.00%> (ø)
...pentripplanner/api/mapping/PlannerErrorMapper.java 0.00% <ø> (ø)
.../opentripplanner/api/model/error/PlannerError.java 0.00% <ø> (ø)
... and 4 more

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@leonardehrenfried leonardehrenfried left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-Transmodel part is fine.

@t2gran
t2gran merged commit f09ae28 into opentripplanner:dev-2.x Jul 24, 2023
@t2gran
t2gran deleted the otp2_remove_system_error branch July 24, 2023 10:59
t2gran pushed a commit that referenced this pull request Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Improvement A functional improvement or micro feature +Sandbox This will be implemented as a Sandbox feature !Technical Debt Improve code quality, no functional changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants