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

@venncity/errors

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venncity/errors - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [1.3.0](https://github.com/venn-city/npm-shelf/compare/@venncity/errors@1.2.0...@venncity/errors@1.3.0) (2019-09-03)
### Features
* **errors:** Add ThrottlingError ([d1006a1](https://github.com/venn-city/npm-shelf/commit/d1006a1))
# [1.2.0](https://github.com/venn-city/npm-shelf/compare/@venncity/errors@1.1.2...@venncity/errors@1.2.0) (2019-07-01)

@@ -8,0 +19,0 @@

4

package.json
{
"name": "@venncity/errors",
"version": "1.2.0",
"version": "1.3.0",
"author": "Venn Engineering",

@@ -29,3 +29,3 @@ "main": "src/index.js",

},
"gitHead": "0b2b6ba67cc007508439a90e03010e3e493410c4"
"gitHead": "b0e5430d37fc53dd9a6b799928aec2c01d736aaf"
}

@@ -1,2 +0,10 @@

const { UnknownError, ForbiddenError, ServerDataValidationError, ClientDataValidationError, VennError, VError } = require('./errors');
const {
UnknownError,
ForbiddenError,
ServerDataValidationError,
ClientDataValidationError,
VennError,
ThrottlingError,
VError
} = require('./errors');

@@ -24,2 +32,12 @@ describe('Errors', () => {

test('verify TnrottlingError to contain all required fields', () => {
const throttlingError = new ThrottlingError({ cause: new Error('nested'), message: 'msg' });
expect(throttlingError).toMatchObject({
isVennError: true,
message: 'msg: nested'
});
expect(VError.info(throttlingError)).toEqual({ clientVisible: false, statusCode: 429 });
expect(VError.cause(throttlingError)).toHaveProperty('message', 'nested');
});
test('verify VennError to contain all required fields', () => {

@@ -26,0 +44,0 @@ const vennError = new VennError({ cause: new Error('nested'), message: 'msg', statusCode: 300, clientVisible: false });

@@ -6,2 +6,3 @@ const { VError } = require('verror');

const VENN_FORBIDDEN_ERROR = 'VennForbiddenError';
const VENN_THROTTLING_ERROR = 'VennThrottlingError';
const VENN_SERVER_DATA_VALIDATION_ERROR = 'VennServerDataValidationError';

@@ -24,2 +25,8 @@ const VENN_CLIENT_DATA_VALIDATION_ERROR = 'VennClientDataValidationError';

class ThrottlingError extends VennError {
constructor({ cause, message, clientVisible }) {
super({ cause, message, clientVisible, statusCode: 429, name: VENN_THROTTLING_ERROR });
}
}
class DataValidationError extends VennError {

@@ -70,2 +77,3 @@ constructor({ cause, message, clientVisible, statusCode, name }) {

ForbiddenError,
ThrottlingError,
VennError,

@@ -77,2 +85,3 @@ VError,

VENN_FORBIDDEN_ERROR,
VENN_THROTTLING_ERROR,
VENN_SERVER_DATA_VALIDATION_ERROR,

@@ -79,0 +88,0 @@ VENN_CLIENT_DATA_VALIDATION_ERROR

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