
Product
Introducing Socket MCP for Claude Desktop
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
nestjs-exceptions
Advanced tools
Provides Nest custom exceptions and exception filters.
$ npm i nestjs-exceptions
Nest.js version | nestjs-exceptions compatible version |
---|---|
8.x.x | 8.x.x |
7.x.x | 7.x.x |
You might want to use IntegrationError
to wrap integration errors with a custom message.
throw new IntegrationError(`Service runtime error.`, causeError);
const bootstrap = async () => {
const app = await NestFactory.create(AppModule);
app.useGlobalFilters(new GlobalExceptionFilter());
...
await app.listen(3000);
};
bootstrap();
GlobalExceptionFilter
takes care mainly of internal server errors.
You can configure it during instantiation so that the original cause of 500 errors are returned back to the client. The default is false
for security reasons.
const sendInternalServerErrorCause = true;
new GlobalExceptionFilter(sendInternalServerErrorCause);
By default, only 500 errors are logged in the server side. This can avoid performance issues or Denial of Service attacks because the server is being to much verbose logging.
Anyways, for development reasons or debugging it's possible to log all errors:
const sendInternalServerErrorCause = false;
const logAllErrors = true;
new GlobalExceptionFilter(sendInternalServerErrorCause, logAllErrors);
Or log only specific errors (besides 500):
const sendInternalServerErrorCause = false;
const logAllErrors = false;
const logErrorsWithStatusCode = [400, 401];
new GlobalExceptionFilter(sendInternalServerErrorCause, logAllErrors, logErrorsWithStatusCode);
FAQs
Nest custom exceptions and exception filters.
The npm package nestjs-exceptions receives a total of 182 weekly downloads. As such, nestjs-exceptions popularity was classified as not popular.
We found that nestjs-exceptions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.