New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

five-bells-shared

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

five-bells-shared - npm Package Compare versions

Comparing version 8.0.1 to 8.1.0

26

errors/already-exists-error.js
'use strict'
module.exports = function AlreadyExistsError (message) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
}
const BaseError = require('./base-error')
require('util').inherits(module.exports, Error)
class AlreadyExistsError extends BaseError {
constructor (message) {
super(message)
}
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Already Exists: ' + this.message)
ctx.status = 409
ctx.body = {
id: this.name,
message: this.message
* handler (ctx, log) {
log.warn('Already Exists: ' + this.message)
ctx.status = 409
ctx.body = {
id: this.name,
message: this.message
}
}
}
module.exports = AlreadyExistsError
'use strict'
module.exports = function InvalidModificationError (message, invalidDiffs) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
this.invalidDiffs = invalidDiffs
}
const BaseError = require('./base-error')
require('util').inherits(module.exports, Error)
module.exports.prototype.formatDiff = function (diff) {
if (typeof diff !== 'object') {
return JSON.stringify(diff)
class InvalidModificationError extends BaseError {
constructor (message, invalidDiffs) {
super(message)
this.invalidDiffs = invalidDiffs
}
const path = diff.path ? ' `' + diff.path.join('.') + '`' : ''
switch (diff.kind) {
case 'N':
return 'added' + path + ', value: ' + JSON.stringify(diff.rhs)
case 'D':
return 'deleted' + path + ', was: ' + JSON.stringify(diff.lhs)
case 'E':
return 'changed' + path + ' from: ' + JSON.stringify(diff.lhs) +
' to: ' + JSON.stringify(diff.rhs)
case 'A':
return 'array' + path + ', index ' + diff.index +
' ' + this.formatDiff(diff.item)
default:
formatDiff (diff) {
if (typeof diff !== 'object') {
return JSON.stringify(diff)
}
const path = diff.path ? ' `' + diff.path.join('.') + '`' : ''
switch (diff.kind) {
case 'N':
return 'added' + path + ', value: ' + JSON.stringify(diff.rhs)
case 'D':
return 'deleted' + path + ', was: ' + JSON.stringify(diff.lhs)
case 'E':
return 'changed' + path + ' from: ' + JSON.stringify(diff.lhs) +
' to: ' + JSON.stringify(diff.rhs)
case 'A':
return 'array' + path + ', index ' + diff.index +
' ' + this.formatDiff(diff.item)
default:
return JSON.stringify(diff)
}
}
}
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Invalid Modification: ' + this.message)
if (this.invalidDiffs) {
for (let diff of this.invalidDiffs) {
log.debug(' -- ' + this.formatDiff(diff))
* handler (ctx, log) {
log.warn('Invalid Modification: ' + this.message)
if (this.invalidDiffs) {
for (let diff of this.invalidDiffs) {
log.debug(' -- ' + this.formatDiff(diff))
}
}
ctx.status = 400
ctx.body = {
id: this.name,
message: this.message,
invalidDiffs: this.invalidDiffs
}
}
ctx.status = 400
ctx.body = {
id: this.name,
message: this.message,
invalidDiffs: this.invalidDiffs
}
}
module.exports = InvalidModificationError
'use strict'
module.exports = function InvalidUriParameterError (message, validationErrors) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
this.validationErrors = validationErrors
}
const BaseError = require('./base-error')
require('util').inherits(module.exports, Error)
class InvalidUriParameterError extends BaseError {
constructor (message, validationErrors) {
super(message)
this.validationErrors = validationErrors
}
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Invalid URI parameter: ' + this.message)
ctx.status = 400
ctx.body = {
id: this.name,
message: this.message,
validationErrors: this.validationErrors
* handler (ctx, log) {
log.warn('Invalid URI parameter: ' + this.message)
ctx.status = 400
ctx.body = {
id: this.name,
message: this.message,
validationErrors: this.validationErrors
}
}
}
module.exports = InvalidUriParameterError
'use strict'
module.exports = function NotFoundError (message) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
}
const BaseError = require('./base-error')
require('util').inherits(module.exports, Error)
class NotFoundError extends BaseError {
constructor (message) {
super(message)
}
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Not Found: ' + this.message)
ctx.status = 404
ctx.body = {
id: this.name,
message: this.message
* handler (ctx, log) {
log.warn('Not Found: ' + this.message)
ctx.status = 404
ctx.body = {
id: this.name,
message: this.message
}
}
}
module.exports = NotFoundError
'use strict'
module.exports = function UnauthorizedError (message, validationErrors) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
this.validationErrors = validationErrors
}
const BaseError = require('./base-error')
require('util').inherits(module.exports, Error)
class UnauthorizedError extends BaseError {
constructor (message, validationErrors) {
super(message)
this.validationErrors = validationErrors
}
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Invalid Body: ' + this.message)
ctx.status = 403
ctx.body = {
id: this.name,
message: this.message
* handler (ctx, log) {
log.warn('Invalid Body: ' + this.message)
ctx.status = 403
ctx.body = {
id: this.name,
message: this.message
}
}
}
module.exports = UnauthorizedError
'use strict'
const UnprocessableEntityError =
require('./unprocessable-entity-error')
const UnprocessableEntityError = require('./unprocessable-entity-error')
module.exports = function UnmetConditionError (message) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
}
class UnmetConditionError extends UnprocessableEntityError {
constructor (message) {
super(message)
}
require('util').inherits(module.exports, UnprocessableEntityError)
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Execution Condition Not Met: ' + this.message)
ctx.status = 422
ctx.body = {
id: this.name,
message: this.message
* handler (ctx, log) {
log.warn('Execution Condition Not Met: ' + this.message)
ctx.status = 422
ctx.body = {
id: this.name,
message: this.message
}
}
}
module.exports = UnmetConditionError
'use strict'
module.exports = function UnprocessableEntityError (message) {
Error.captureStackTrace(this, this.constructor)
this.name = this.constructor.name
this.message = message
}
const BaseError = require('./base-error')
require('util').inherits(module.exports, Error)
class UnprocessableEntityError extends BaseError {
constructor (message) {
super(message)
}
module.exports.prototype.handler = function *(ctx, log) {
log.warn('Unprocessable: ' + this.message)
ctx.status = 422
ctx.body = {
id: this.name,
message: this.message
* handler (ctx, log) {
log.warn('Unprocessable: ' + this.message)
ctx.status = 422
ctx.body = {
id: this.name,
message: this.message
}
}
}
module.exports = UnprocessableEntityError

@@ -8,1 +8,11 @@ exports.Config = require('./lib/config')

exports.DB = require('./lib/db')
exports.BaseError = require('./errors/base-error')
exports.AlreadyExistsError = require('./errors/already-exists-error')
exports.InvalidBodyError = require('./errors/invalid-body-error')
exports.InvalidModificationError = require('./errors/invalid-modification-error')
exports.InvalidUriParameterError = require('./errors/invalid-uri-parameter-error')
exports.NotFoundError = require('./errors/not-found-error')
exports.UnauthorizedError = require('./errors/unauthorized-error')
exports.UnmetConditionError = require('./errors/unmet-condition-error')
exports.UnprocessableEntityError = require('./errors/unprocessable-entity-error')
{
"name": "five-bells-shared",
"version": "8.0.1",
"version": "8.1.0",
"description": "Shared components for Five Bells projects.",
"keywords": [
"interledger",
"five-bells",
"ilp"
],
"main": "index.js",

@@ -6,0 +11,0 @@ "scripts": {

@@ -26,2 +26,10 @@ {

"type": "string"
},
"public_key": {
"description": "Account public key for signing HTTP requests",
"type": "string"
},
"is_admin": {
"description": "admin flag",
"type": "boolean"
}

@@ -28,0 +36,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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