lib/munit.js
function( code, e, message ) {
		var callback = munit.render.callback;

		// Force a numeric code for the first parameter
		if ( ! munit.isNumber( code ) ) {
			throw new Error( "Numeric code parameter required for munit.exit" );
		}

		// Allow code, message only arguments
		if ( message === undefined && munit.isString( e ) ) {
			message = e;
			e = null;
		}

		// Messaging
		if ( munit.isString( message ) ) {
			munit.color.red( message );
		}

		// Force an error object for callbacks
		if ( ! munit.isError( e ) ) {
			e = new Error( message || 'munit exited' );
		}
		e.code = code;

		// Only print out stack trace on an active process
		if ( munit.render.state !== munit.RENDER_STATE_COMPLETE ) {
			munit.log( e.stack );
		}

		// Callback takes priority
		if ( callback ) {
			munit.render.callback = undefined;
			callback( e, munit );
		}
		// No callback, end the process
		else {
			munit._exit( code );
		}
	}
function( code, e, message ) {
		var callback = munit.render.callback;

		// Force a numeric code for the first parameter
		if ( ! munit.isNumber( code ) ) {
			throw new Error( "Numeric code parameter required for munit.exit" );
		}

		// Allow code, message only arguments
		if ( message === undefined && munit.isString( e ) ) {
			message = e;
			e = null;
		}

		// Messaging
		if ( munit.isString( message ) ) {
			munit.color.red( message );
		}

		// Force an error object for callbacks
		if ( ! munit.isError( e ) ) {
			e = new Error( message || 'munit exited' );
		}
		e.code = code;

		// Only print out stack trace on an active process
		if ( munit.render.state !== munit.RENDER_STATE_COMPLETE ) {
			munit.log( e.stack );
		}

		// Callback takes priority
		if ( callback ) {
			munit.render.callback = undefined;
			callback( e, munit );
		}
		// No callback, end the process
		else {
			munit._exit( code );
		}
	}
function ( code , e , message ) { var callback = munit . render . callback ; // Force a numeric code for the first parameter if ( ! munit . isNumber ( code ) ) { throw new Error ( "Numeric code parameter required for munit.exit" ) ; } // Allow code, message only arguments if ( message === undefined && munit . isString ( e ) ) { message = e ; e = null ; } // Messaging if ( munit . isString ( message ) ) { munit . color . red ( message ) ; } // Force an error object for callbacks if ( ! munit . isError ( e ) ) { e = new Error ( message || 'munit exited' ) ; } e . code = code ; // Only print out stack trace on an active process if ( munit . render . state !== munit . RENDER_STATE_COMPLETE ) { munit . log ( e . stack ) ; } // Callback takes priority if ( callback ) { munit . render . callback = undefined ; callback ( e , munit ) ; } // No callback, end the process else { munit . _exit ( code ) ; } }
Helper for printing out errors before exiting
Helper for printing out errors before exiting