api-client: set up error enums/types

This commit is contained in:
dumbmoron 2024-09-11 20:19:43 +00:00
parent abb6a26ee0
commit ab8650030b
No known key found for this signature in database

View file

@ -0,0 +1,66 @@
export enum CobaltAuthError {
JWTMissing = 'error.api.auth.jwt.missing',
JWTInvalid = 'error.api.auth.jwt.invalid',
TurnstileMissing = 'error.api.auth.turnstile.missing',
TurnstileInvalid = 'api.auth.turnstile.invalid'
};
export enum CobaltReachabilityError {
Unreachable = 'error.api.unreachable',
TimedOut = 'error.api.timed_out',
RateExceeded = 'error.api.rate_exceeded',
AtCapacity = 'error.api.capacity'
};
export enum CobaltGenericError {
Generic = 'error.api.generic',
UnknownResponse = 'error.api.unknown_response'
};
export enum CobaltServiceError {
Unsupported = 'error.api.service.unsupported',
Disabled = 'error.api.service.disabled'
};
export enum CobaltLinkError {
Invalid = 'error.api.link.invalid',
FormatUnsupported = 'error.api.link.unsupported'
};
export enum CobaltProcessingError {
Fail = 'error.api.fetch.fail',
Critical = 'error.api.fetch.critical',
Empty = 'error.api.fetch.empty',
RateLimited = 'error.api.fetch.rate',
ShortLink = 'error.api.fetch.short_link'
};
export enum CobaltContentError {
TooLong = 'error.api.content.too_long',
VideoUnavailable = 'error.api.content.video.unavailable',
VideoIsLive = 'error.api.content.video.live',
VideoIsPrivate = 'error.api.content.video.private',
VideoIsAgeRestricted = 'error.api.content.video.age',
VideoIsRegionRestricted = 'error.api.content.video.region',
PostUnavailable = 'error.api.content.post.unavailable',
PostIsPrivate = 'error.api.content.post.private',
PostIsAgeRestricted = 'error.api.content.post.age',
};
export enum CobaltYouTubeError {
MissingCodec = 'error.api.youtube.codec',
CannotDecipher = 'error.api.youtube.decipher',
MissingLogin = 'error.api.youtube.login',
TokenExpired = 'error.api.youtube.token_expired'
}
export type CobaltAPIError = CobaltAuthError
| CobaltReachabilityError
| CobaltGenericError
| CobaltServiceError
| CobaltLinkError
| CobaltProcessingError
| CobaltContentError
| CobaltYouTubeError;