MCPcopy
hub / github.com/balderdashy/sails / _terminateProcess

Function _terminateProcess

errors/fatal.js:181–207  ·  view source on GitHub ↗

* _terminateProcess * * Terminate the process as elegantly as possible. * If process.env is 'test', throw instead. * * @param {[type]} code [console error code] * @param {[type]} opts [currently unused]

(code /*, opts */)

Source from the content-addressed store, hash-verified

179 * @param {[type]} opts [currently unused]
180 */
181function _terminateProcess(code /*, opts */) {
182
183 // FUTURE: get rid of this (actual handling will be inline where the fatal errors are
184 // actually coming from, so we'll be able to handle it there by actually throwing.
185 // That way, it's up to the caller whether it wants to catch the original error and
186 // do a deliberate process.exit and omit the error stack (which can be disorienting
187 // for folks new to SSJ/Node.js))
188 //
189 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
190 // TODO: Double-check on this, and then remove it if possible:
191 // (I'm pretty sure we can get rid of this now b/c all tests have been updated.
192 // We should definitely never be checking that NODE_ENV is or isn't anything other
193 // than "production")
194 if (process.env.NODE_ENV === 'test') {
195 throw new Error({
196 type: 'terminate',
197 code: code,
198 // options: {
199 // todo: 'put the stuff from the original errors in here'
200 // }
201 // ^^ Removed this in Sails v1 since it was useless anyways. ~Mike Dec 11, 2016
202 });
203 }//-•
204 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
205
206 return process.exit(code);
207}

Callers 1

fatal.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…