/**
 * Module dependencies
 */
var util = require('util');
var _ = require('lodash');
var constants = require('./constants');



/**
 * factory
 *
 * @return {Switchback}
 *
 * An anonymous function is used as the base for switchbacks so that
 * they are both dereferenceable AND callable.  This allows functions
 * which accept switchback definitions to maintain compatibility with
 * standard node callback conventions (which are better for many situations).
 *
 * This also means that instantiated switchbacks may be passed interchangably
 * into functions expecting traditional node callbacks, and everything will
 * "just work".
 */

module.exports = function(callbackContext) {

  var _switch = function( /* err, arg1, arg2, ..., argN */ ) {
    var args = Array.prototype.slice.call(arguments);

    // Trigger error handler
    var err = args[0];
    if (err) {
      return _switch.error.apply(callbackContext || this, args);
    }
    return _switch.success.apply(callbackContext || this, args.slice(1));
  };

  // Mark switchback function so it can be identified for tests
  _switch[constants.telltale.key] = constants.telltale.value;

  // Mix in non-enumerable `.inspect()` method
  Object.defineProperty(this, 'inspect', { enumerable: false, writable: true });
  _switch.inspect = function () { return '[Switchback]'; };

  return _switch;
};

@@ -859,24 +859,620 @@
  if (err) %7B%0A
+      // If the error has a %60.exit%60 property that corresponds with the name of an exit,%0A      // call that exit instead of %60error%60. This makes it possible for %60sb(e)%60 to work%0A      // as a type of clean, conventional error negotiation, allowing usage like:%0A      // %60%60%60%0A      // function (inputs, exits) %7B%0A      //   try %7B doStuff(); %7D%0A      //   catch (e) %7B return exits(e); %7D%0A      //   return exits();%0A      // %7D%0A      // %60%60%60%0A      if (_.isObject(err) && _.isString(err.exit) && _.isFunction(_switch%5Berr.exit%5D)) %7B%0A        return _switch%5Berr.exit%5D.apply(callbackContext %7C%7C this, args);%0A      %7D%0A
       return

Make sb(err) usage use the .exit property to try and negotiate a more appropriate handler.