This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Return JSON response from syntax highlighter in presence of errors #62689
Labels
bug
An error, flaw or fault that produces an incorrect or unexpected result, or behavior.
graph/syntax-highlighter
Related to issues with syntax highlighting
team/graph
Graph Team (previously Code Intel/Language Tools/Language Platform)
tech-debt
Technical Debt
The Rocket server we're using sometimes return HTML responses. In error cases, it should be possible to make it return JSON responses.
https://rocket.rs/guide/v0.5/requests/#built-in-catcher
The above docs make it sound like simply setting a header
Accept: application/json
should be good enough to do the trick. There is also a customization point here if needed: https://api.rocket.rs/v0.5/rocket/catcher/struct.CatcherWe should add an integration test to make sure we're returning JSON in the error case (Rocket docs on testing: https://rocket.rs/guide/v0.5/testing/). We should also make sure that the caller in gosyntect handles the error case properly (e.g. logging).
Related:
The text was updated successfully, but these errors were encountered: