@aex/errors

errors

Usage no npm install needed!

<script type="module">
  import aexErrors from 'https://cdn.skypack.dev/@aex/errors';
</script>

README

Build Status Coverage Status MIT license

@aex/errors

import { AexErrors } from "@aex/errors";
import { Aex } from "@aex/core";
import * as path from "path";

const aex = new Aex();
const dirName = path.resolve(__dirname, "./errors");
const middleware = AexErrors(dirName, false);
aex.use(middleware);
aex.use(async (_req: any, res, scope: any) => {
  const { errors } = scope.outer;
  const { UserNotFound, PasswordNotFound } = errors;
  throw new UserNotFound("zh-CN");
  throw new UserNotFound("en-US");
  res.end("ok");
});