When using findOrFail()
or findOneOrFail()
from typeORM, a 500 error is returned if there is no entity (EntityNotFoundError).
To make it returns a 404, use an exception filter as described in https://docs.nestjs.com/exception-filters .
file /src/filters/entity-not-found-exception.filter.ts