Sha256: ddee7c2c1fa690c771466b256911d4f86424141c3242f89d22c98a910fe43d3b

Contents?: true

Size: 827 Bytes

Versions: 6

Compression:

Stored size: 827 Bytes

Contents

export default class CliArgumentError extends Error {
  static MESSAGES = {
    cwdRequired: 'Current working directory is required as first argument.',
    entrypointRequired: 'An entry point is required as second argument.',
    builderRequired: 'The builder is required as third and final argument.',

    cwdUnknown: ({ cwd }) => `A valid working directory is required - received ${cwd}`,
    entrypointUnknown: ({ entrypoint }) =>
      `A valid entrypoint is required - received ${entrypoint}`,
    builderUnknown: ({ builder }) => `Unknown builder '${builder}'`
  }

  constructor(reason, options) {
    let message = CliArgumentError.MESSAGES[reason]
    if (typeof message === 'function') {
      message = message(options)
    }

    super(message, options)

    this.reason = reason
    this.message = message
  }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
proscenium-0.1.0.alpha2-x86_64-linux lib/proscenium/cli/argument_error.js
proscenium-0.1.0.alpha2-x86_64-darwin lib/proscenium/cli/argument_error.js
proscenium-0.1.0.alpha2-arm64-darwin lib/proscenium/cli/argument_error.js
proscenium-0.1.0.alpha1-x86_64-linux lib/proscenium/cli/argument_error.js
proscenium-0.1.0.alpha1-x86_64-darwin lib/proscenium/cli/argument_error.js
proscenium-0.1.0.alpha1-arm64-darwin lib/proscenium/cli/argument_error.js