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

ApiError classs inherrited from error not working #162

Open
TejasM6767 opened this issue Sep 4, 2024 · 3 comments
Open

ApiError classs inherrited from error not working #162

TejasM6767 opened this issue Sep 4, 2024 · 3 comments

Comments

@TejasM6767
Copy link

throw new ApiError(400,"xyz")
even we throw this ApiError on postman/broweser we get the message correct but status code 500
i tried everything but haven't fount any answers.......
Screenshot (10)
Screenshot (11)
Screenshot (12)

@TejasM6767
Copy link
Author

ok we just need to not pass anythign in super()
u can see line 11 in vscode....

@AnkitBorude
Copy link

please close the issue from your side

@Sambit99
Copy link

Sambit99 commented Dec 23, 2024

Do it like this:

return res.status(400).json(new ApiError(400,"Username/Email is required"))

or

throw new ApiError(400,"Username/Email is required")

without using res.

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

3 participants