Comparing version 4.0.3 to 4.0.4
@@ -16,3 +16,3 @@ (function(self) { | ||
if (e.fullref) return e; | ||
let result = {ref : e.ref || ref || fullref, message: e.message || e, fullref: e.fullref || fullref, caller: e.caller || caller, stack: e.stack || '', error: true, notDefined: e.notDefined, report: e.report || report, value: e.value, cache: e.cache}; | ||
let result = {ref : e.ref || ref || fullref, message: e.message || e, fullref: e.fullref || fullref, caller: e.caller || caller, stack: e.stack || '', error: true, notDefined: e.notDefined, report: e.report || report, value: e.value, cache: e.cache, cluesHasLogged: e.cluesHasLogged}; | ||
return result; | ||
@@ -298,3 +298,6 @@ }; | ||
let wrappedEx = createEx(e || {}, fullref, caller, ref, true); | ||
if (e && e.stack && typeof $global.$logError === 'function') $global.$logError(wrappedEx, fullref); | ||
if (e && e.stack && !wrappedEx.cluesHasLogged && typeof $global.$logError === 'function') { | ||
wrappedEx.cluesHasLogged = true; | ||
$global.$logError(wrappedEx, fullref); | ||
} | ||
return storeRef(logic, ref, reject(wrappedEx), fullref, caller); | ||
@@ -301,0 +304,0 @@ }; |
{ | ||
"name": "clues", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "Lightweight logic tree solver using promises.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -87,2 +87,3 @@ const clues = require('../clues'); | ||
$logError : function(e,f) { | ||
this.counter = (this.counter||0)+1; | ||
this.error = e; | ||
@@ -113,6 +114,19 @@ this.fullref = f; | ||
t.same($global.error.message,'error','error passed to $logError'); | ||
t.same($global.counter,1,'logError is called once'); | ||
t.ok($global.error.stack,'contains a stack'); | ||
t.same($global.error.fullref,'stack_error_promise','fullref ok'); | ||
}); | ||
t.test('promise rejected with a stack', async t => { | ||
const $global = Object.create(Global); | ||
const facts = { | ||
stack_error_promise: () => clues.reject(new Error('error')), | ||
reffed_error: stack_error_promise => stack_error_promise | ||
}; | ||
await clues(facts,'reffed_error',$global).then(shouldErr,Object); | ||
t.same($global.error.message,'error','error passed to $logError'); | ||
t.same($global.counter,1,'logError is called once'); | ||
t.ok($global.error.stack,'contains a stack'); | ||
}); | ||
t.test('error without a stack (rejection)', async t => { | ||
@@ -119,0 +133,0 @@ const $global = Object.create(Global); |
@@ -23,3 +23,6 @@ // See optimization killers https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#1-tooling | ||
%OptimizeFunctionOnNextCall(clues); | ||
clues(); | ||
%OptimizeFunctionOnNextCall(clues); | ||
//The next call | ||
@@ -32,3 +35,4 @@ clues() | ||
const d = await execAsync('echo "'+code+'" | node --allow-natives-syntax', { cwd: __dirname }); | ||
console.log(d); | ||
t.same(!!((d & 4) || (d & 16)), true); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
112337
37
2046