Skip to content

Instantly share code, notes, and snippets.

@rgregg
Created June 19, 2015 20:39
Embed
What would you like to do?
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