Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @baywet @ddyett @MichaelMainer @nikithauc @zengin @peombwa @finsharp @jobala @silaskenneth @Ndiritu @shemogumbe @samwelkanda @calebkiage
37 changes: 35 additions & 2 deletions content/ErrorContent.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,41 @@

## Objectives

Provide access to error information included in the response body of a 4XX or 5XX response.
- Provide access to error information included in the response body of a 4XX or 5XX response.
- Define standard class names for error scenarios.

## Requirements

- Match the specification as defined by the Microsoft API Guidelines
- Match the specification as defined by the [Microsoft API Guidelines](https://github.com/microsoft/api-guidelines/blob/07a1e42e3e33f94df782abfcbaec24b63968c120/Guidelines.md#5-taxonomy) for errors returned in API responses.
- Service errors SHOULD be defined in a class named GraphServiceException or GraphServiceError depending on the platform.
- Service errors SHOULD contain the response status code and response headers.
- Client errors SHOULD be defined in a class named GraphClientException or GraphClientError depending on the platform.
- Client and service errors should use common properties according to the Microsoft API Guidelines.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the json representation of the graph service error - https://docs.microsoft.com/en-us/graph/errors#json-representation

The ServiceException should capture these properties


GraphServiceException or GraphServiceError MUST support all potential OData error properties. See [Microsoft Graph error JSON](https://docs.microsoft.com/en-us/graph/errors#json-representation) for more information. The following is an example GraphServiceException response payload.

```json
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'mef'.",
"innerError": {
"date": "2021-07-02T01:40:19",
"request-id": "1a0ffbc0-086f-4e8f-93f9-bf99881c65f6",
"client-request-id": "225aed2b-cf4a-d456-b313-16ab196c2364"
}
}
}
```

## Reference service error implementations

- JavaScript - [GraphError](https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/src/GraphError.ts)
- .NET - [ServiceException](https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/blob/feature/2.0/src/Microsoft.Graph.Core/Exceptions/ServiceException.cs)
- Java - [GraphServiceException](https://github.com/microsoftgraph/msgraph-sdk-java-core/blob/dev/src/main/java/com/microsoft/graph/http/GraphServiceException.java)

## Reference client error implementations

- JavaScript - [GraphClientError](https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/src/GraphClientError.ts)
- .NET - [ClientException](https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/blob/dev/src/Microsoft.Graph.Core/Exceptions/ClientException.cs), everything had been a ServiceException.
- Java - [ClientException](https://github.com/microsoftgraph/msgraph-sdk-java-core/blob/dev/src/main/java/com/microsoft/graph/core/ClientException.java)