I am using raven-js and facing some issue with Raven.context method. Following is the demo code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raven.js/3.22.1/raven.min.js"></script>
</head>
<body>
<script>
Raven.config('<SENTRY_CLIENT_URL>').install();
const sendError = () => {
const a = {};
a.push(3);
}
const insideContext =() => {
const b = [];
console.log(b);
b.push(3);
};
sendError();
Raven.context(insideContext);
</script>
</body>
</html>
In this case I assume only exceptions to be reported to sentry are the ones which occur inside insideContext function but it catches the exception caused in sendError. In fact it catches all the exceptions even caused by 3rd party libraries not which are used independently from sendError or insideContext. How can I make Raven.context to catch errors only inside ‘insideContext’