Share via

Handle Ms graph predefined exception like 429

Niraj Bagde 20 Reputation points
2024-12-19T05:47:03.12+00:00

I am using ns graph sdk for java , want to handle exception like 503 and 429 but not able to get the response code in exception as not getting any specific class for the details

using following dependency

<dependency>
			<groupId>com.microsoft.graph</groupId>
			<artifactId>microsoft-graph-auth</artifactId>
			<version>0.3.0</version>
		</dependency>
		<dependency>
			<groupId>com.microsoft.graph</groupId>
			<artifactId>microsoft-graph-core</artifactId>
			<version>3.1.14</version>
		</dependency>
		<dependency>
			<groupId>com.microsoft.graph</groupId>
			<artifactId>microsoft-graph</artifactId>
			<version>6.13.0</version>
		</dependency>
		<dependency>
			<groupId>com.azure</groupId>
			<artifactId>azure-identity</artifactId>
			<version>1.3.4</version>
		</dependency>

Microsoft 365 and Office | OneDrive | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. RajatVashisthaMSFT-7255 1,780 Reputation points
    2025-01-13T09:02:56.4966667+00:00

    Hi Niraj Bagde,

    Thank you for contacting Microsoft!

    The 503 (Service Unavailable) and 429 (Too Many Requests) errors indicate that the client application has been throttled, and the request needs to be retried after a delay.

    To help mitigate this, please refer to the following best practices for handling throttling:

    https://learn.microsoft.com/en-us/graph/throttling#best-practices-to-avoid-throttling

    https://learn.microsoft.com/en-us/graph/throttling-limits#outlook-service-limits

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.