diff --git a/src/shared/error/error.ts b/src/shared/error/error.ts index fc09d31..3e8d8e6 100644 --- a/src/shared/error/error.ts +++ b/src/shared/error/error.ts @@ -1,6 +1,16 @@ +function createErrorMessage(message: string) { + if (process.env.NODE_ENV === 'production') { + const errorCode = message + return `Minified EventTrackerError error #${errorCode}. Visit https://github.com/emkis/gtm-event-tracker#error-codes for the full message.` + } + + return message +} + export class EventTrackerError extends Error { constructor(message: string) { - super(message) + const parsedMessage = createErrorMessage(message) + super(parsedMessage) this.name = 'EventTrackerError' } }