PHP client library Exceptions sometimes have error code 0 (zero)...?

I am using the PHP client library. :muscle:

Sometimes when catching \Asana\Errors Exceptions, the Exception code will be 0 yet have a member status with the actual HTTP response code.

Is this a known issue or does the team not consider this to be an issue? I just figured it might not be intended since getCode() will actually be the HTTP code while other times it will be 0 and the status member will have the HTTP code.

For instance…

I found this particular behavior when calling $client->tags->create() with an invalid workspace gid param. The call threw an \Asana\Errors\NotFoundError with getCode() of int(0) and a status member variable of int(404).

If memory serves, calling $client->tasks->findById() actually returns a getCode() of int(404) which I have been depending on. Yet, I did notice that same call returning Forbidden would not actually have a getCode() of 403—I just didn’t think too much of it at the time! :upside_down_face:

Why getCode()

So I’m a little confused what’s intended, but I prefer to catch(\Exception $e) to then perform actions based on error code ranges as opposed to catching by each custom Exception type.

What is the difference between \Asana\Errors Exception code versus status? Is status more reliable? Are they supposed to be the same? :confounded: