Skip to content

Instantly share code, notes, and snippets.

@rgregg
Created June 19, 2015 20:39
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rgregg/a1866be15e685983b441 to your computer and use it in GitHub Desktop.
Save rgregg/a1866be15e685983b441 to your computer and use it in GitHub Desktop.
OneDrive Error Code Handling
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Microsoft.OneDrive
{
public class OneDriveError
{
[JsonProperty("error")]
public OneDriveInnerError Error { get; set; }
public static OneDriveError FromJson(string json)
{
return JsonConvert.DeserializeObject<OneDriveError>(json);
}
public bool IsError(string expectedErrorCode)
{
OneDriveInnerError errorCode = this.Error;
while (null != errorCode)
{
if (errorCode.Code == expectedErrorCode)
return true;
errorCode = errorCode.InnerError;
}
return false;
}
}
public class OneDriveInnerError
{
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("message")]
public string Message { get; set; }
[JsonProperty("innererror")]
public OneDriveInnerError InnerError { get; set; }
}
}
@ibrahimfandauda
Copy link

Hello Microsoft why to much error code can't you fix it? is be long time sence is problem started??????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment