Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@curveball/problem

Package Overview
Dependencies
Maintainers
4
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 0.3.0 to 0.3.1

7

changelog.md
Changelog
=========
0.3.1 (2022-01-17)
------------------
* The individual settings passed to the middleware factory can now be omitted.
* Update dependencies.
* Update linting rules.
0.3.0 (2021-02-18)

@@ -5,0 +12,0 @@ ------------------

4

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

@@ -6,3 +6,3 @@ "use strict";

let debugMode = false;
if (settings && settings.debug !== undefined) {
if ((settings === null || settings === void 0 ? void 0 : settings.debug) !== undefined) {
debugMode = settings.debug;

@@ -14,3 +14,3 @@ }

let quiet = false;
if (settings && settings.quiet !== undefined) {
if ((settings === null || settings === void 0 ? void 0 : settings.quiet) !== undefined) {
quiet = settings.quiet;

@@ -27,9 +27,9 @@ }

let detail;
if (http_errors_1.isHttpError(e)) {
if ((0, http_errors_1.isHttpError)(e)) {
status = e.httpStatus;
clientError = http_errors_1.isClientError(e);
if (e.title) {
clientError = (0, http_errors_1.isClientError)(e);
if ((0, http_errors_1.isHttpProblem)(e) && e.title) {
title = e.title;
}
if (e.detail) {
if ((0, http_errors_1.isHttpProblem)(e) && e.detail) {
detail = e.detail;

@@ -72,3 +72,2 @@ }

else {
// tslint:disable-next-line no-console
console.error(e);

@@ -75,0 +74,0 @@ }

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

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

"@types/chai": "^4.2.15",
"@types/mocha": "^7.0.2",
"@types/node": "^10.17.53",
"@types/sinon": "^9.0.10",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"@types/mocha": "^9.0.0",
"@types/node": "^12.20.41",
"@types/sinon": "^10.0.6",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"chai": "^4.3.0",
"eslint": "^7.20.0",
"mocha": "^7.2.0",
"eslint": "^8.6.0",
"mocha": "^9.1.4",
"nyc": "^15.1.0",
"sinon": "^9.2.4",
"ts-node": "^8.10.2",
"typescript": "^3.9.9"
"sinon": "^12.0.1",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},

@@ -59,0 +59,0 @@ "types": "dist/",

@@ -80,2 +80,3 @@ Curveball Problem Middleware

});
```

@@ -86,2 +87,1 @@

[3]: https://github.com/curveball/http-errors
import { Middleware } from '@curveball/core';
import { HttpProblem, isClientError, isHttpError } from '@curveball/http-errors';
import { isClientError, isHttpError, isHttpProblem } from '@curveball/http-errors';
type ProblemMwSettings = {
debug: boolean | undefined,
quiet: boolean | undefined,
debug?: boolean;
quiet?: boolean;
};

@@ -12,3 +12,3 @@

let debugMode = false;
if (settings && settings.debug !== undefined) {
if (settings?.debug !== undefined) {
debugMode = settings.debug;

@@ -20,3 +20,3 @@ } else if (process.env.NODE_ENV === 'development') {

let quiet = false;
if (settings && settings.quiet !== undefined) {
if (settings?.quiet !== undefined) {
quiet = settings.quiet;

@@ -29,3 +29,3 @@ }

await next();
} catch (e) {
} catch (e: any) {

@@ -40,7 +40,7 @@ let status: number;

clientError = isClientError(e);
if ((<HttpProblem> e).title) {
title = (<HttpProblem> e).title;
if (isHttpProblem(e) && e.title) {
title = e.title;
}
if ((<HttpProblem> e).detail) {
detail = (<HttpProblem> e).detail;
if (isHttpProblem(e) && e.detail) {
detail = e.detail;
}

@@ -88,3 +88,2 @@

} else {
// tslint:disable-next-line no-console
console.error(e);

@@ -91,0 +90,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc