Skip to main content
The SDK draws a clear line between two kinds of failure:
  • Problems with authentication — bad credentials, a revoked agent, an unreachable MudraID. These the SDK raises as exceptions.
  • Responses from the platform you called — a 404, a 409, a 500 from the API itself. These come back as normal responses for your code to handle.
Understanding that line is the whole of error handling here.

Catch the base class for anything SDK-originated

Every exception the SDK raises inherits from MudraIDError. Catch the base class to handle all of them in one place:

Catch a subclass when you want to react specifically

Platform responses are not exceptions

A 4xx or 5xx from the platform itself is returned to you as an ordinary requests.Response. The SDK does not raise it — your code decides what a 404 or a 409 means for your application.
The one exception is a 401 from the platform: the SDK assumes the token expired, refreshes it, and retries once before handing the response back. So you rarely see a 401 at all.