Skip to content

Conversation

@nikithauc
Copy link
Contributor

#342

Problem -

  1. The issue reported states that the response was empty with a -1 status code. I was unable to reproduce this issue for "/subscriptions".

However, I was able to get an empty response when I tried the following example to set the client-

const client = MicrosoftGraph.Client.init({
	defaultVersion: "v1.0",
	debugLogging: true,
	authProvider: (done) => {
		done(null, "");
	},
});
then try client.api("/me").get().

export type AuthProviderCallback = (error: any, accessToken: string | null) => void; If the implementation
of AuthProviderCallback created by the consumer returns an empty string for an access token and the error is set null, the response by the Graph SDK is an empty one with status code as -1 which could be confusing.
2. The GraphErrorHandler takes in error parameter of type 'any' but didn't handle, say error of type 'string', correctly.

Solution in this PR -

  1. If the access token is empty and the error specified is undefined/null, create a GraphError stating that the AccessToken is needs to specified.
  2. Also, modified the GraphErrorHandler to handle any type error parameter that is passed appropriately .

@nikithauc nikithauc changed the title Nikitha/graph clientside error Empty error reported in the SDK Nov 10, 2020
zengin
zengin previously approved these changes Nov 17, 2020
zengin
zengin previously approved these changes Nov 17, 2020
@nikithauc nikithauc merged commit 96b40bd into dev Dec 21, 2020
@nikithauc nikithauc mentioned this pull request Dec 21, 2020
5 tasks
@nikithauc nikithauc deleted the nikitha/graph-clientside-error branch March 31, 2021 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants