{"size": 414, "ext": "js", "max_stars_repo_path": "src/errors.js", "max_stars_repo_name": "aboamare/mirabom", "max_stars_repo_stars_event_min_datetime": "2022-03-17T12:16:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T12:16:34.000Z", "max_issues_repo_path": "src/errors.js", "max_issues_repo_name": "aboamare/mirabom", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/errors.js", "max_forks_repo_name": "aboamare/mirabom", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.8181818182, "max_line_length": 55, "alphanum_fraction": 0.6086956522}
export class MirError extends Error {
  constructor (code, msg) {
    if (!MirError[code]) {
      throw new Error(`Invalid Mir error code ${code}`)
    }
    super(msg)
    this.code = code
  }
}

const Codes = {
  IdUnavailable: 'Suggested ID is not available'
}

for (let code in Codes) {
  Object.assign(MirError, {
    [code]: function (msg) {
      return new MirError(code, msg || Codes[code])
    }
  })
}
