Errors¶
Custom Exceptions
-
exception
gretel_client.errors.
BadRequest
(msg: dict)¶ A custom error class that can be raised when a non-200 OK is received back from the Gretel API.
The Gretel API returns errors with the following format:
{ "message": "a description of what is wrong" "context": {} }
The
context
key will contain structured information about a particular field if there was an error with it.-
as_str
()¶ Return the error as a single string by combining the message and serializing the
context
to a JSON string.Example:
'Invalid JSON Payload: {"foo": ["Unknown field."]}'
-
context
= None¶ A dictionary that contains field-specific errors from the request that was made.
Example POST payload with invalid field:
{'foo': ['Unknown field.']}
-
message
= None¶ A human readable description of what went wrong
-
-
exception
gretel_client.errors.
ClientError
¶ Generic exception that can be thrown
-
exception
gretel_client.errors.
Forbidden
¶ HTTP 403. The only time this is returned is during rate limiting of API calls
-
exception
gretel_client.errors.
NotFound
(msg: dict)¶ HTTP 404
Represents a 401 that gets returned from the Gretel API authorizer. Because this is directly handled by our authorizer Lambdas, we get a different body back (missing the
context
) object.The message string returned from the API