I’ve created a function to catch the errors through Meteor._debug()
But I cannot save the value of stack
variable. It is an object but there are no keys. JSON.stringify()
also doesn’t work. When I do stack.toString()
I can only get the first line of the stack trace. But it displays properly with console.log()
.
Any idea?
This is in the server
const originalMeteorDebug = Meteor._debug;
Meteor._debug = (message, stack) => {
if (Meteor.isDevelopment) {
console.log('===== message =====', message);
console.log('===== stack =====', stack);
}
errorLogger.error(`Server Error: ${message}`, stack.toString());
return originalMeteorDebug.apply(this, arguments);
};
Here is the sample output in my admin panel
@rjdavid check out the Kadira APM code for some of the inner secrets of getting this sort of info.
I used a bunch of those tricks in this package:
import Rollbar from 'rollbar'
import { Meteor } from 'meteor/meteor'
import { Accounts } from 'meteor/accounts-base'
import { Blaze } from 'meteor/blaze'
import { Tracker } from 'meteor/tracker'
import { Injected } from 'meteor/meteorhacks:inject-initial'
import { wrapMeteorDebug } from './common'
export let rollbar
Meteor.startup(function () {
const { accessToken, environment } = Meteor.settings.public.rollbar
rollbar = window.rollbar = new Rollbar({
accessToken,
captureUncaught: true,
captureUnhandledRejections: true,
ignoredMessages: [
// eslint-disable-next-line
'Blocked a frame with origin "https://next.focuster.com" from accessing a frame with origin "https://js.stripe.com". Protocols, domains, and ports must match.',
'Exception in template helper:',
This file has been truncated. show original
Would love to perhaps generalize all the error extraction tricks into a module that multiple packages could use.,…
1 Like
Thanks, @hexsprite . I’ll take a look.