jhoerr / box-csharp-sdk-v2

A C# client for the Box API (v2).
http://developers.box.com/docs/
11 stars 15 forks source link

Getting to the status codes #14

Closed mascon closed 11 years ago

mascon commented 11 years ago

Can you provide a code snippet showing how to get to the error results of the BOX update

Like the 200, 300. 400. 500 events

I did not find one in your tests and samples

jhoerr commented 11 years ago

Try this:

try
{
    // Try to fetch one of my folders...
    Client.GetFolder("482710136");
}
catch (BoxException e)
{
    // Should be a 403: Forbidden
    Console.Out.WriteLine(e.HttpStatusCode);
}
mascon commented 11 years ago

That works fine. Should I just except that if I do not get an exception the call received a 2XX response?

The reason I ask is I am making update calls that are not updating the users. However no exception is thrown

jhoerr commented 11 years ago

Yep -- BoxExceptions are only thrown when the client determines that something bad has happened.

On Mon, Jan 7, 2013 at 3:09 PM, mascon notifications@github.com wrote:

That works fine. Should I just except that if I do not get an exception the call received a 2XX response?

— Reply to this email directly or view it on GitHubhttps://github.com/jhoerr/box-csharp-sdk-v2/issues/14#issuecomment-11969048.

John Hoerr jhoerr@gmail.com 503.360.6581