Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong title when is not filled #12

Open
clabnet opened this issue Feb 1, 2023 · 1 comment
Open

Wrong title when is not filled #12

clabnet opened this issue Feb 1, 2023 · 1 comment

Comments

@clabnet
Copy link

clabnet commented Feb 1, 2023

When you create an error without specifyng the title :

 const successResult = createError(200, {
      message: 'Success',
      body: {
        code: 'OK',
        level: ErrorLevelEnum.INFO
      }
    })

the title attribute contain the wrong text Internal Server Error

  isHttpError: true,
  statusCode: 200,
  title: "Internal Server Error",
  message: "Success",
  body: {
    code: "OK",
    level: "info",
  },
  status: 200,
@JoBrad
Copy link
Owner

JoBrad commented Feb 2, 2023

The library only has pre-filled values for status codes >= 400. You're getting the default value for title because your status code is below that. Try the same code but with a 401, to see what I mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants