node-code-error
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -48,4 +48,4 @@ 'use strict' | ||
function buildCode (opts) { | ||
opts.actionCode = opts.actionCode || '' | ||
opts.objectCode = opts.objectCode || '' | ||
opts.actionCode = opts.actionCode === 0 ? 0 : opts.actionCode || '' | ||
opts.objectCode = opts.objectCode === 0 ? 0 : opts.objectCode || '' | ||
return +('' + opts.typeCode + opts.objectCode + opts.actionCode) | ||
@@ -52,0 +52,0 @@ } |
13
index.js
@@ -29,6 +29,7 @@ 'use strict' | ||
var actCode = CONFIG.get('action', arr[1]) | ||
if (!isCode(objCode)) throw new Error('unrecognized error object') | ||
if (!isCode(actCode)) throw new Error('unrecognized error action') | ||
codeObj.objectCode = objCode | ||
codeObj.actionCode = actCode | ||
if (isCode(objCode) && isCode(actCode)) { | ||
codeObj.objectCode = objCode | ||
codeObj.actionCode = actCode | ||
} | ||
} | ||
@@ -62,4 +63,4 @@ codeObj.type = type | ||
} | ||
if (objectCode !== undefined) codeObj.objectCode = objectCode | ||
if (objectCode !== undefined) codeObj.actionCode = actionCode | ||
codeObj.objectCode = objectCode || 0 | ||
codeObj.actionCode = actionCode || 0 | ||
CONFIG.typeMap[name] = codeObj | ||
@@ -66,0 +67,0 @@ } |
{ | ||
"name": "node-code-error", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "define node error with code", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
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
18226