🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@curveball/problem

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@curveball/problem - npm Package Compare versions

Comparing version

to
0.2.2

8

changelog.md
Changelog
=========
0.2.2 (2020-06-05)
---------
* Added a `quiet` flag to supress 4XX client errors from the log.
* Typescript target is now es2019 instead of esnext to ensure that older
Node.js versions are supported.
0.2.1 (2020-01-05)

@@ -5,0 +13,0 @@ ------------------

3

dist/index.d.ts
import { Middleware } from '@curveball/core';
declare type ProblemMwSettings = {
debug: boolean;
debug: boolean | undefined;
quiet: boolean | undefined;
};
export default function (settings?: ProblemMwSettings): Middleware;
export {};

@@ -12,2 +12,6 @@ "use strict";

}
let quiet = false;
if (settings && settings.quiet !== undefined) {
quiet = settings.quiet;
}
return async (ctx, next) => {

@@ -60,4 +64,6 @@ try {

if (clientError) {
// tslint:disable-next-line no-console
console.warn(e);
if (!quiet) {
// tslint:disable-next-line no-console
console.warn(e);
}
}

@@ -64,0 +70,0 @@ else {

{
"name": "@curveball/problem",
"version": "0.2.1",
"version": "0.2.2",
"description": "A middleware for converting errors into application/problem+json",

@@ -14,3 +14,3 @@ "main": "dist/index.js",

"type": "git",
"url": "git+https://github.com/curveballjs/problem.git"
"url": "git+https://github.com/curveball/problem.git"
},

@@ -39,18 +39,18 @@ "files": [

"bugs": {
"url": "https://github.com/curveballjs/problem/issues"
"url": "https://github.com/curveball/problem/issues"
},
"homepage": "https://github.com/curveballjs/problem#readme",
"homepage": "https://github.com/curveball/problem#readme",
"devDependencies": {
"@curveball/core": "^0.10.0",
"@types/chai": "^4.2.7",
"@types/mocha": "^5.2.7",
"@types/node": "^10.17.13",
"@types/sinon": "^7.5.1",
"@curveball/core": "^0.12.0",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@types/node": "^10.17.24",
"@types/sinon": "^9.0.4",
"chai": "^4.2.0",
"mocha": "^7.0.0",
"nyc": "^15.0.0",
"sinon": "^8.0.2",
"ts-node": "^8.5.4",
"tslint": "^5.20.1",
"typescript": "^3.7.4"
"mocha": "^7.2.0",
"nyc": "^15.1.0",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"tslint": "^6.1.2",
"typescript": "^3.9.5"
},

@@ -65,3 +65,12 @@ "types": "dist/",

"@curveball/core": ">=0.9 <1"
},
"mocha": {
"require": "ts-node/register",
"recursive": true,
"extension": [
"ts",
"js",
"tsx"
]
}
}
Curveball Problem Middleware
===========================
[![Greenkeeper badge](https://badges.greenkeeper.io/curveballjs/problem.svg)](https://greenkeeper.io/)
This package is a middleware for the [Curveball][2] framework that catches any

@@ -72,5 +70,17 @@ exception and turns them into `application/problem+json` responses, as defined

### Quiet mode
If quiet mode is enabled, 4XX errors are not logged. Client errors are common
and usually expected behavior, so it might be preferable for them to not spam
the log.
```typescript
app.use(problemMw({
quiet: true
});
[1]: https://tools.ietf.org/html/rfc7807
[2]: https://github.com/curveballjs/
[3]: https://github.com/curveballjs/http-errors
[2]: https://github.com/curveball/
[3]: https://github.com/curveball/http-errors

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet