1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00
ssh-key-action/node_modules/err-code/index.js
2019-09-18 20:39:54 +09:00

22 lines
397 B
JavaScript

'use strict';
function createError(msg, code, props) {
var err = msg instanceof Error ? msg : new Error(msg);
var key;
if (typeof code === 'object') {
props = code;
} else if (code != null) {
err.code = code;
}
if (props) {
for (key in props) {
err[key] = props[key];
}
}
return err;
}
module.exports = createError;