function mapException(exception, warningHandler) {
        try {
            if(exception instanceof Error) {
                var stacktrace;
                return options.getExceptionInfo(exception).then(function(trace){
                    stacktrace = trace

                    var smcFutures = []
                    for(var n=0; n<trace.length; n++) {
                        if(trace[n].file !== undefined) {
                            smcFutures.push(getSourceMapConsumer(trace[n].file, warningHandler))
                        } else {
                            smcFutures.push(Future(undefined))
                        }
                    }

                    return Future.all(smcFutures)
                }).then(function(sourceMapConsumers) {
                    var CustomMappedException = proto(MappedException, function() {
                        // set the name so it looks like the original exception when printed
                        // this subclasses MappedException so that name won't be an own-property
                        this.name = exception.name
                    })

                    try {
                        throw CustomMappedException(exception, stacktrace, sourceMapConsumers)  // IE doesn't give exceptions stack traces unless they're actually thrown
                    } catch(mappedExcetion) {
                        return Future(mappedExcetion)
                    }
                })
            } else {
                return Future(exception)
            }
        } catch(e) {
            var errorFuture = new Future
            errorFuture.throw(e)
            return errorFuture
        }
    }
function mapException(exception, warningHandler) {
        try {
            if(exception instanceof Error) {
                var stacktrace;
                return options.getExceptionInfo(exception).then(function(trace){
                    stacktrace = trace

                    var smcFutures = []
                    for(var n=0; n<trace.length; n++) {
                        if(trace[n].file !== undefined) {
                            smcFutures.push(getSourceMapConsumer(trace[n].file, warningHandler))
                        } else {
                            smcFutures.push(Future(undefined))
                        }
                    }

                    return Future.all(smcFutures)
                }).then(function(sourceMapConsumers) {
                    var CustomMappedException = proto(MappedException, function() {
                        
                        
                        this.name = exception.name
                    })

                    try {
                        throw CustomMappedException(exception, stacktrace, sourceMapConsumers)  
                    } catch(mappedExcetion) {
                        return Future(mappedExcetion)
                    }
                })
            } else {
                return Future(exception)
            }
        } catch(e) {
            var errorFuture = new Future
            errorFuture.throw(e)
            return errorFuture
        }
    }
function mapException ( exception , warningHandler ) { try { if ( exception instanceof Error ) { var stacktrace ; return options . getExceptionInfo ( exception ) . then ( function ( trace ) { stacktrace = trace var smcFutures = [ ] for ( var n = 0 ; n < trace . length ; n ++ ) { if ( trace [ n ] . file !== undefined ) { smcFutures . push ( getSourceMapConsumer ( trace [ n ] . file , warningHandler ) ) } else { smcFutures . push ( Future ( undefined ) ) } } return Future . all ( smcFutures ) } ) . then ( function ( sourceMapConsumers ) { var CustomMappedException = proto ( MappedException , function ( ) { // set the name so it looks like the original exception when printed // this subclasses MappedException so that name won't be an own-property this . name = exception . name } ) try { throw CustomMappedException ( exception , stacktrace , sourceMapConsumers ) // IE doesn't give exceptions stack traces unless they're actually thrown } catch ( mappedExcetion ) { return Future ( mappedExcetion ) } } ) } else { return Future ( exception ) } } catch ( e ) { var errorFuture = new Future errorFuture . throw ( e ) return errorFuture } }
takes an exception and returns a future exception that has a stacktrace with sourcemapped tracelines
takes an exception and returns a future exception that has a stacktrace with sourcemapped tracelines