Skip to content

Commit 5a39925

Browse files
committed
adding the graph api response interface
1 parent 09aa804 commit 5a39925

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/GraphErrorHandler.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
import { GraphError } from "./GraphError";
1313
import { GraphRequestCallback } from "./IGraphRequestCallback";
1414

15+
/**
16+
* @interface
17+
* Signature for the json represent of the error response from the Graph API
18+
* https://docs.microsoft.com/en-us/graph/errors
19+
* @property {[key: string] : string | number} - The Key value pair
20+
*/
21+
interface GraphAPIErrorResponse {
22+
error: {
23+
code: string;
24+
message: string;
25+
innerError: any;
26+
};
27+
}
28+
1529
/**
1630
* @class
1731
* Class for GraphErrorHandler
@@ -57,7 +71,7 @@ export class GraphErrorHandler {
5771
* }
5872
* }
5973
*/
60-
private static constructErrorFromResponse(graphError: any, statusCode: number): GraphError {
74+
private static constructErrorFromResponse(graphError: GraphAPIErrorResponse, statusCode: number): GraphError {
6175
const error = graphError.error;
6276
const gError = new GraphError(statusCode, error.message);
6377
gError.code = error.code;

0 commit comments

Comments
 (0)