createLavaMoatError = (name, code, ctor) => {
  Object.defineProperties(ctor, {
    code: { value: code, enumerable: true },
    name: { value: name },
  })
  Object.defineProperties(ctor.prototype, {
    code: { value: code, enumerable: true },
    name: { value: name },
    [Symbol.toStringTag]: { value: name },
  })

  return /** @type {LavaMoatErrorClass<Code, Options>} */ (
    /** @type {unknown} */ (ctor)
  )
}
Given a name, code, and implementation, create a new
{@link LavaMoatErrorClass}.

This handles some boilerplate when creating new custom error classes.

@template {ErrorCode} Code
@template {ErrorOptions} [Options=ErrorOptions] Default is `ErrorOptions`
@param {string} name
@param {Code} code
@param {Class<Error, LavaMoatErrorClassParams<Options>>} ctor
@returns {LavaMoatErrorClass<Code, Options>}