NestJS · Senior · Question 71 of 75

Why should domain services throw domain errors rather than HttpExceptions?

Explanation

A UserNotFoundError becomes 404 in HTTP, NOT_FOUND in GraphQL, and a non-retryable failure in a queue.

Further reading

Problem with a question

NestJS · Senior · question 71

Test yourself

Take the NestJS · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz