@atlaskit/profilecard
Version:
A React component to display a card with user information.
59 lines • 1.68 kB
JavaScript
export class HttpError extends Error {
constructor(code, reason, traceId) {
super(reason);
this.code = code;
this.traceId = traceId;
}
}
export class DirectoryGraphQLError extends Error {
constructor(message, category, type, extensions = {}, path = []) {
super(message);
this.category = category;
this.type = type;
this.path = path.join('.');
const {
errorNumber,
...unknownExtension
} = extensions;
this.errorNumber = extensions.errorNumber;
this.extensions = unknownExtension;
}
}
export class DirectoryGraphQLErrors extends Error {
constructor(errors, traceId) {
super('DirectoryGraphQLErrors');
this.traceId = traceId;
if (Array.isArray(errors)) {
this.errors = errors.map(error => new DirectoryGraphQLError(error.message, error.category, error.type, error.extensions, error.path));
} else {
this.errors = [];
}
}
}
export class AGGError extends Error {
constructor(message, extensions, path = []) {
super(message);
this.path = path === null || path === void 0 ? void 0 : path.join('.');
const {
statusCode,
errorType,
classification,
...unknownExtension
} = extensions;
this.statusCode = statusCode;
this.errorType = errorType;
this.classification = classification;
this.extensions = unknownExtension;
}
}
export class AGGErrors extends Error {
constructor(errors, traceId) {
super('AGGErrors');
this.traceId = traceId;
if (Array.isArray(errors)) {
this.errors = errors.map(error => new AGGError(error.message, error.extensions, error.path));
} else {
this.errors = [];
}
}
}