import { Jsonable } from '.'

// Reuse common error messages for meta parsing
export enum MetaParseErrorType {
  'PARSE_ERROR_EVENT' = 'error occurred in parsing the create signature event',
  'PARSE_ERROR_SIGNATURE_EVENT_CONTENT' = "err in parsing the createSignature event's content"
}

export class MetaParseError extends Error {
  public readonly context?: Jsonable

  constructor(
    message: string,
    options: { cause?: Error; context?: Jsonable } = {}
  ) {
    const { cause, context } = options

    super(message, { cause })
    this.name = this.constructor.name

    this.context = context
  }
}
