Error handling

If an error response is received from the TransLink Open API, tilapya.TransLinkAPIError is raised. This class parses the error body and exposes its values as members.

class tilapya.TransLinkAPIError(response)[source]

An error response from the TransLink API.

Variables:
  • code – API error code. Only applies to the RTTI API.
  • message – Message from the error response. Empty if the response body is invalid or empty.
  • request – The request that led to the error response.
  • response – The original response.
description

The documented description of the error code, if any.

If there was a problem deserializing the response according to the expected schema, marshmallow.exceptions.ValidationError is raised from the marshmallow library. This should not occur unless the underlying API changes significantly.