code: function handleError(routes, index, stage, e, location) {
  
          return loopThroughErrorHandlers(location, index)
  
  
          function loopThroughErrorHandlers(location, n) {
              if(n >= 0) {
                  var route = routes[n].route
                  if(route.errorHandler !== undefined) {
                      try {
                          var result = route.errorHandler(e, {stage: stage, location: location})
                      } catch(e) {
                          var result = new Future
                          result.throw(e)
                      }
  
                      if(result === undefined) {
                          result = Future(undefined)
                      }
  
                      return result.catch(function(e) {
                          if(index > 0) {
                              return handleError(routes, n-1, stage, e, route.pathSegment)
                          } else {
                              throw e // ran out of error handlers
                          }
                      })
                  } else {
                      return loopThroughErrorHandlers(route.pathSegment.concat(location), n-1)
                  }
              } else {
                  var f = new Future
                  f.throw(e)
                  return f
              }
          }
      }
docs: routes is the full list of currentRoutes index is the route index where the error happened stage is the stage the router was in when the error happened ('exit', 'enter', or 'route') location is the relative pathSegment to where the error happened e is the error that happened