Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

com.microsoft.kiota.serialization.ParseNodeFactoryRegistry throws RuntimeException if service returns status code 503 with unexpected content type #1683

Copy link
Copy link
@etcoyvindf

Description

@etcoyvindf
Issue body actions

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.

  1. Make getParseNode throw ApiException, which is a bit safer to try/catch than a pure "catch all" RuntimeException
  2. 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

No one assigned

    Labels

    enhancementNew feature or requestNew feature or requesttype:enhancementEnhancement request targeting an existing experienceEnhancement request targeting an existing experience

    Projects

    Status

    Waits for author 🔁
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.