Description
Situation and background:
The Microsoft Graph API had some issues some days ago, where some calls to the API would return HTTP status code 503, with some html error message.
During this time, our use of the Graph API SDK, which in turn uses Kiota, lead to several application level crashes, because of uncaught RuntimeExceptions was propagated up the call stack from Kiota.
My observations, based on my understanding of the code:
The source of the exception, ParseNodeFactoryRegistry method getParseNode will attempt to find a parser for an expected content type.
In the case of Graph API, we expect JSON, so we only set up factories to handle that.
When the Graph API has an issue/downtime/whathaveyou, the method finds no factory to handle the response, and throws a RuntimeException directly.
Straight forward, I feel theres' two possible solutions.
- Make getParseNode throw ApiException, which is a bit safer to try/catch than a pure "catch all" RuntimeException
- Add a special case content type text/html factory that handles special error page responses, which might be in scope only for the graph api sdk.
With limited knowledge of how easy a custom factory is as an end user of MS Graph SDK, we feel forced to stop catching ApiException, and start catching RuntimeExceptions instead, hoping that no other runtime exceptions gets thrown and swallowed by our logic.
Metadata
Metadata
Assignees
Type
Projects
Status