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

seneca

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seneca - npm Package Compare versions

Comparing version 3.8.2 to 3.8.3

6

CHANGES.md

@@ -0,1 +1,7 @@

## 3.8.3 2019-02-25
* Seneca.fail throws Seneca Errors, whereas Seneca.error creates them
* Seneca.error can create plugin scoped errors
## 3.8.2 2019-02-17

@@ -2,0 +8,0 @@

44

lib/api.js

@@ -16,15 +16,39 @@ /* Copyright © 2010-2018 Richard Rodger and other contributors, MIT License. */

exports.fail = function(code) {
var plugin_fullname =
this.fixedargs && this.fixedargs.plugin$ && this.fixedargs.plugin$.full
// Create a Seneca Error, OR set a global error handler function
exports.error = function(first) {
if ('function' === typeof first) {
this.options({ errhandler: first })
return this
} else {
if (null == first) {
throw this.util.error('no_error_code')
}
var plugin =
null != plugin_fullname
? this.private$.plugins[plugin_fullname]
: this.context.plugin
var plugin_fullname =
this.fixedargs && this.fixedargs.plugin$ && this.fixedargs.plugin$.full
if (plugin && plugin.eraro && plugin.eraro.has(code)) {
throw plugin.eraro.apply(this, arguments)
var plugin =
null != plugin_fullname
? this.private$.plugins[plugin_fullname]
: this.context.plugin
var error = null
if (plugin && plugin.eraro && plugin.eraro.has(first)) {
error = plugin.eraro.apply(this, arguments)
} else {
error = Common.eraro.apply(this, arguments)
}
return error
}
}
// NOTE: plugin error codes are in their own namespaces
exports.fail = function(code, args) {
var error = this.error(code, args)
if (args && false === args.throw$) {
return error
} else {
throw Common.eraro.apply(this, arguments)
throw error
}

@@ -31,0 +55,0 @@ }

@@ -8,2 +8,4 @@ /* Copyright © 2010-2018 Richard Rodger and other contributors, MIT License. */

test_args: 'Test args <%=arg0%> <%=arg1%>.',
test_prop:

@@ -130,2 +132,5 @@ 'TESTING: exists: <%=exists%>, notfound:<%=notfound%>, str=<%=str%>,' +

no_error_code:
'The Seneca.error or Seneca.fail method was called without an error code string as first argument.',
// Legacy error message codes

@@ -132,0 +137,0 @@

@@ -37,3 +37,6 @@ /* Copyright © 2010-2018 Richard Rodger and other contributors, MIT License. */

numparents: meta.parents.length,
parents: _.map(meta.parents, p => p[0]),
parents: _.map(
meta.parents,
p => p[Common.TRACE_PATTERN] + ' ' + p[Common.TRACE_ACTION]
),
args: Util.inspect(Common.clean(data.msg)).replace(/\n/g, '')

@@ -40,0 +43,0 @@ }

@@ -233,2 +233,4 @@ /* Copyright © 2014-2018 Richard Rodger and other contributors, MIT License. */

var base = {}
// NOTE: plugin error codes are in their own namespaces
var errors = plugindef.errors || (plugindef.init && plugindef.init.errors)

@@ -235,0 +237,0 @@

{
"name": "seneca",
"description": "A Microservices Framework for Node.js",
"version": "3.8.2",
"version": "3.8.3",
"license": "MIT",

@@ -72,6 +72,5 @@ "homepage": "http://senecajs.org",

"scripts": {
"test": "lab -v -P test -L -t 85 -I URL,URLSearchParams,SharedArrayBuffer,Atomics,BigUint64Array,BigInt64Array,BigInt,TextEncoder,TextDecoder,queueMicrotask",
"test": "lab -v -P test -L -t 85 ",
"coveralls": "lab -s -P test -r lcov | coveralls",
"coverage": "lab -v -P test -L -t 85 -r html > docs/coverage.html",
"annotate": "docco seneca.js lib/*.js -o docs/annotated",
"smoke": "node test/stubs/launch.js",

@@ -107,10 +106,9 @@ "prettier": "prettier --write *.js lib/*.js test/*.js",

"bench": "^0.3.6",
"code": "^4.1.0",
"code": "^5.2.4",
"coveralls": "^3.0.2",
"docco": "^0.8.0",
"handlebars": "^4.1.0",
"hoek": "^4.2.1",
"hoek": "^5.0.4",
"lab": "^18.0.2",
"prettier": "^1.16.4",
"seneca-entity": "^2.5.1",
"seneca-entity": "^3.0.1",
"seneca-error-test": "^0.2.2",

@@ -117,0 +115,0 @@ "seneca-joi": "^3.1.0"

@@ -409,2 +409,4 @@ /* Copyright © 2010-2018 Richard Rodger and other contributors, MIT License. */

root$.outward = API.outward // Add a modifier function for responses outward
root$.error = API.error // Set global error handler, or generate Seneca Error
root$.fail = opts.$.legacy.fail ? Legacy.make_legacy_fail(opts.$) : API.fail // Throw a Seneca error

@@ -417,8 +419,4 @@ root$.add = api_add // Add a pattern an associated action.

root$.options = api_options // Get and set options.
root$.error = api_error // Set global error handler.
root$.decorate = api_decorate // Decorate seneca object with functions
// DEPRECATE Legacy fail in 4.x
root$.fail = opts.$.legacy.fail ? Legacy.make_legacy_fail(opts.$) : API.fail
// Non-API methods.

@@ -982,7 +980,2 @@ root$.register = Plugins.register(opts, callpoint)

function api_error(errhandler) {
this.options({ errhandler: errhandler })
return this
}
// Inspired by https://github.com/hapijs/hapi/blob/master/lib/plugin.js decorate

@@ -989,0 +982,0 @@ // TODO: convert to seneca errors

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