How to throw 404 error. #2289
Answered
by
sindresorhus
meotimdihia
asked this question in
Q&A
-
I want to throw a 404 error, ex: throw new RequestError(404) I don't use it for testing but in this case, the request returns 200 code, but in truth, it is 404. |
Beta Was this translation helpful? Give feedback.
Answered by
sindresorhus
Aug 7, 2023
Replies: 1 comment 3 replies
-
Where do you want to throw it? You haven't shared enough context for us to be able to give you a good answer. I would also recommend using ChatGPT for questions like this. Here's a template prompt:
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can import
HTTPError
from Got and throw that.