1.3.3 • Published 2 years ago

@use-services/httperr v1.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

HttpErr

// 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();
1.3.3

2 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago