OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
294 stars 143 forks source link

Better check for specific ServiceExceptions #162

Closed tipa closed 8 years ago

tipa commented 8 years ago

To check for a specific exception inside a catch I would like to do something like this: catch (ServiceException e) { if (e.Error.Code == OneDriveErrorCode.ItemNotFound.ToString()) { ... } }

But currently, e.Error.Code is "itemNotFound" and OneDriveErrorCode.ItemNotFound.ToString() is "ItemNotFound". I can workaround this issue with a "ToLower()" but it would be nice to do that comparison based on enums. Or am I missing something?

tipa commented 8 years ago

I saw just now that IsMatch() is incasesensitive....