Is this a successful failure? or a failed success?

  • I am working with a Calendar sync REST API that uses OAuth and downloaded a library from nuget to deal with it. As soon as I tried it out, an exception was thrown during the upsert of my calendar events. The exception was vague: "Response indicates failure." Well, that could mean anything from me sending invalid info to the server just having a temporary temper tantrum.

    I turned on Fiddler and saw that the request was coming through fine. "200 OK" was the status, and the response body indicated everything is okie dokie. Plus, I went into my calendar and found that the event had, in fact, been added. The plot thickens! What's going on? I found the source in github and came across this peculiar code:

     // TODO: Add info to the exception for more 
     // info for user in case this was a validation error
     if (response.Code != 202) {
         throw new Exception("Response indicates failure");


    Well, I guess I'll have to fork the damn source and fix this fucked up nonsense.

  • Impossible Mission - B

    So the only status it expects is Accepted? I wonder what that says about the conditions under which this code was originally written...

  • @masonwheeler I'm sure originally the API used a 202 for this request, since I guess it was technically correct if they were queuing it for some kind of asynchronous operation. However, since this was an upsert, I could see 201 "Created" or of course 200 being just as valid depending on the circumstances, and having your client not even account for that possibility is ludicrous.

  • Ugh. If you're gonna do this shit, at least return a proper error.

  • Discourse touched me in a no-no place

    @cartman82 Or write the info to the log.

  • @cartman82 said in Is this a successful failure? or a failed success?:

    Ugh. If you're gonna do this shit, at least return a proper error.

    ...or pass on the error code you received, so we can at least guess at the proper error.

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.