Functions for handling Mastodon API errors.
Methods
(inner) isAccessTokenRevokedError(error) → {boolean}
Returns true if the error is an access token revoked error.
Parameters:
Name | Type | Description |
---|---|---|
error |
UnknownError | The error to check. |
Returns:
True if the error is an access token revoked error.
- Type
- boolean
(inner) isRateLimitError(error) → {boolean}
Returns true if the error is a rate limit error.
Parameters:
Name | Type | Description |
---|---|---|
error |
UnknownError | The error to check. |
Returns:
True if the error is a rate limit error.
- Type
- boolean
(inner) throwIfAccessTokenRevoked(logger, error, msg)
Throws if the error is an access token revoked error, otherwise logs and moves on.
Parameters:
Name | Type | Description |
---|---|---|
logger |
Logger | Logger instance. |
error |
UnknownError | The error to check. |
msg |
string | Message to log. |
Throws:
-
If the error is an access token revoked error.
- Type
- unknown
(inner) throwSanitizedRateLimitError(error, msg)
Throws a sanitized rate limit error if detected, otherwise logs and throws the original error.
Parameters:
Name | Type | Description |
---|---|---|
error |
UnknownError | The error to check. |
msg |
string | Message to log. |
Throws:
-
Throws a user-friendly rate limit warning or the original error.
- Type
- string | unknown