@use-services/httperr

```ts // in services.ts import * as Echo from "@use-services/echo";

Usage no npm install needed!

<script type="module">
  import useServicesHttperr from 'https://cdn.skypack.dev/@use-services/httperr';
</script>

README

// in services.ts
import * as Echo from "@use-services/echo";

import * as errcodes from "@/errcodes";

const options = {
  errs: {
    init: HttpErr.init,
    args: errcodes,
  } as HttpErr.Option<typeof errcodes>,
};

// in errcodes.ts
const ErrCodes = {
  ErrInternal: {
    status: 500,
    message: "${message}",
    args: {
      message: "server error",
    },
  },
  ErrValidation: {
    status: 400,
    message: "validate failed",
  },
}

// usage
throw srvs.errs.ErrValidation.toError();