change CustomError enum to Record
This commit is contained in:
parent
6969df8b39
commit
4abf00c734
|
@ -11,44 +11,45 @@ export const ServerErrorCodes = {
|
|||
NOT_FOUND: '404',
|
||||
};
|
||||
|
||||
export enum CustomError {
|
||||
SUBSCRIPTION_VERIFICATION_ERROR = 'Subscription verification failed',
|
||||
THUMBNAIL_GENERATION_FAILED = 'thumbnail generation failed',
|
||||
VIDEO_PLAYBACK_FAILED = 'video playback failed',
|
||||
ETAG_MISSING = 'no header/etag present in response body',
|
||||
KEY_MISSING = 'encrypted key missing from localStorage',
|
||||
FAILED_TO_LOAD_WEB_WORKER = 'failed to load web worker',
|
||||
CHUNK_MORE_THAN_EXPECTED = 'chunks more than expected',
|
||||
CHUNK_LESS_THAN_EXPECTED = 'chunks less than expected',
|
||||
UNSUPPORTED_FILE_FORMAT = 'unsupported file formats',
|
||||
FILE_TOO_LARGE = 'file too large',
|
||||
SUBSCRIPTION_EXPIRED = 'subscription expired',
|
||||
STORAGE_QUOTA_EXCEEDED = 'storage quota exceeded',
|
||||
SESSION_EXPIRED = 'session expired',
|
||||
INVALID_MIME_TYPE = 'invalid mime type',
|
||||
SIGNUP_FAILED = 'signup failed',
|
||||
FAV_COLLECTION_MISSING = 'favorite collection missing',
|
||||
INVALID_COLLECTION_OPERATION = 'invalid collection operation',
|
||||
WAIT_TIME_EXCEEDED = 'thumbnail generation wait time exceeded',
|
||||
REQUEST_CANCELLED = 'request canceled',
|
||||
REQUEST_FAILED = 'request failed',
|
||||
TOKEN_EXPIRED = 'token expired',
|
||||
TOKEN_MISSING = 'token missing',
|
||||
TOO_MANY_REQUESTS = 'too many requests',
|
||||
BAD_REQUEST = 'bad request',
|
||||
SUBSCRIPTION_NEEDED = 'subscription not present',
|
||||
NOT_FOUND = 'not found ',
|
||||
NO_METADATA = 'no metadata',
|
||||
TOO_LARGE_LIVE_PHOTO_ASSETS = 'too large live photo assets',
|
||||
NOT_A_DATE = 'not a date',
|
||||
FILE_ID_NOT_FOUND = 'file with id not found',
|
||||
WEAK_DEVICE = 'password decryption failed on the device',
|
||||
INCORRECT_PASSWORD = 'incorrect password',
|
||||
UPLOAD_CANCELLED = 'upload cancelled',
|
||||
REQUEST_TIMEOUT = 'request taking too long',
|
||||
HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED = 'hidden collection sync file attempted',
|
||||
UNKNOWN_ERROR = 'Something went wrong, please try again',
|
||||
}
|
||||
export const CustomError = {
|
||||
SUBSCRIPTION_VERIFICATION_ERROR: 'Subscription verification failed',
|
||||
THUMBNAIL_GENERATION_FAILED: 'thumbnail generation failed',
|
||||
VIDEO_PLAYBACK_FAILED: 'video playback failed',
|
||||
ETAG_MISSING: 'no header/etag present in response body',
|
||||
KEY_MISSING: 'encrypted key missing from localStorage',
|
||||
FAILED_TO_LOAD_WEB_WORKER: 'failed to load web worker',
|
||||
CHUNK_MORE_THAN_EXPECTED: 'chunks more than expected',
|
||||
CHUNK_LESS_THAN_EXPECTED: 'chunks less than expected',
|
||||
UNSUPPORTED_FILE_FORMAT: 'unsupported file formats',
|
||||
FILE_TOO_LARGE: 'file too large',
|
||||
SUBSCRIPTION_EXPIRED: 'subscription expired',
|
||||
STORAGE_QUOTA_EXCEEDED: 'storage quota exceeded',
|
||||
SESSION_EXPIRED: 'session expired',
|
||||
INVALID_MIME_TYPE: (type: string) => `invalid mime type -${type}`,
|
||||
SIGNUP_FAILED: 'signup failed',
|
||||
FAV_COLLECTION_MISSING: 'favorite collection missing',
|
||||
INVALID_COLLECTION_OPERATION: 'invalid collection operation',
|
||||
WAIT_TIME_EXCEEDED: 'thumbnail generation wait time exceeded',
|
||||
REQUEST_CANCELLED: 'request canceled',
|
||||
REQUEST_FAILED: 'request failed',
|
||||
TOKEN_EXPIRED: 'token expired',
|
||||
TOKEN_MISSING: 'token missing',
|
||||
TOO_MANY_REQUESTS: 'too many requests',
|
||||
BAD_REQUEST: 'bad request',
|
||||
SUBSCRIPTION_NEEDED: 'subscription not present',
|
||||
NOT_FOUND: 'not found ',
|
||||
NO_METADATA: 'no metadata',
|
||||
TOO_LARGE_LIVE_PHOTO_ASSETS: 'too large live photo assets',
|
||||
NOT_A_DATE: 'not a date',
|
||||
FILE_ID_NOT_FOUND: 'file with id not found',
|
||||
WEAK_DEVICE: 'password decryption failed on the device',
|
||||
INCORRECT_PASSWORD: 'incorrect password',
|
||||
UPLOAD_CANCELLED: 'upload cancelled',
|
||||
REQUEST_TIMEOUT: 'request taking too long',
|
||||
HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED:
|
||||
'hidden collection sync file attempted',
|
||||
UNKNOWN_ERROR: 'Something went wrong, please try again',
|
||||
};
|
||||
|
||||
function parseUploadErrorCodes(error) {
|
||||
let parsedMessage = null;
|
||||
|
|
Loading…
Reference in a new issue