mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-12 08:08:25 -05:00
15 lines
467 B
TypeScript
15 lines
467 B
TypeScript
import { errorHandler } from '#utils/errorHandler';
|
|
|
|
export class CeramicError extends Error {}
|
|
|
|
export const handleCeramicAuthenticationError = (err: Error) => {
|
|
if (err.message === 'Unexpected token u in JSON at position 0') {
|
|
throw new CeramicError('User canceled authentication.');
|
|
}
|
|
if (err.message === '"undefined" is not valid JSON') {
|
|
throw new CeramicError('Could not authenticate with Ceramic API');
|
|
}
|
|
errorHandler(err);
|
|
throw err;
|
|
};
|