Looking at this example from the Sentry docs - how does the Sentry.captureException know that it's being called within Sentry.withScope?
The Sentry.captureException method will need to access the parameters assigned to that scope such as the user. But no reference of the scope is passed to the function.
    Sentry.withScope(function(scope) {
        scope.setUser(someUser);
        Sentry.captureException(error);
    });
The only way I can imagine to pass data between the two functions is via some kind of try catch trickery. I don't see another way that the Sentry.captureException can know about the parent scope and the parameters associated with that scope.
 
    