MCPcopy Index your code
hub / github.com/restify/node-restify / errEvtNameFromError

Function errEvtNameFromError

lib/server.js:1734–1746  ·  view source on GitHub ↗

* Map an Error's .name property into the actual event name that is emitted * by the restify server object. * * @function * @private errEvtNameFromError * @param {Object} err - an error object * @returns {String} an event name to emit

(err)

Source from the content-addressed store, hash-verified

1732 * @returns {String} an event name to emit
1733 */
1734function errEvtNameFromError(err) {
1735 if (err.name === 'ResourceNotFoundError') {
1736 // remap the name for router errors
1737 return 'NotFound';
1738 } else if (err.name === 'InvalidVersionError') {
1739 // remap the name for router errors
1740 return 'VersionNotAllowed';
1741 } else if (err.name) {
1742 return err.name.replace(/Error$/, '');
1743 }
1744 // If the err is not an Error, then just return an empty string
1745 return '';
1746}
1747
1748/**
1749 * Mounts a chain on the given path against this HTTP verb

Callers 1

server.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected