An error info object that represents a mapped Error to be thrown.

Hierarchy

  • MosaicErrorInfo

Properties

code: string
details?: Dict<unknown>

Additional details to add to the error. These details will be present in the GraphQL API Response and in the resulting log when using Mosaic default settings.

Passing skipMaskTag will mark the resulting log to skip the masking of possible sensitive values, but the skipMaskTag property itself will be removed from the GraphQL API Response details.

Example

import { MosaicError, skipMaskTag } from '@axinom/mosaic-service-common';

throw new MosaicError({
...CustomErrorCode.YourError,
details: { skipMaskTag },
});
error?: Error
logInfo?: Dict<unknown>

Additional information to add to the error to be logged. This info will NOT be present in the GraphQL API Response when using Mosaic default settings.

Passing skipMaskTag will mark the resulting log to skip the masking of possible sensitive values.

Example

import { MosaicError, skipMaskTag } from '@axinom/mosaic-service-common';

throw new MosaicError({
...CustomErrorCode.YourError,
logInfo: { skipMaskTag },
});
message: string
messageParams?: unknown[]

An array of parameter to be used for printf-style message placeholders.

Example

import { MosaicError, MosaicErrors } from '@axinom/mosaic-service-common';

// The MosaicErrors.AssertionFailed.message is: "The assertion check for the identifier %s failed."

throw new MosaicError({
message: MosaicErrors.AssertionFailed.message, // 'The assertion check for the identifier email failed.'
code: 'YOUR_CODE',
messageParams: ['email'],
});

Generated using TypeDoc