-
Notifications
You must be signed in to change notification settings - Fork 787
Conversation
@calebmer this is great! |
console.error('Uncaught (in react-apollo)', error.stack || error); | ||
} | ||
}, 10); | ||
Object.defineProperty(data, 'error', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there be any benefit in only doing this in development mode? Or is the overhead minimal enough that we should just always do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m for always logging because:
- The overhead is fairly small.
- In production a user should really be catching the error anyway.
- Some error tracking libraries may report
console.error
exceptions.
Are console logs still slow in react native? |
@jbaxleyiii as far as I know it’s a safe assumption that React Native logs will always be slow 😣 However, for just printing an error stack trace which is a few bytes of text I highly doubt there will be any performance impact. The real killers for logging in React Native are sophisticated logging libraries like Also, users should really be expected to catch and handle these errors, so even if there is some performance impact on the rare event there is an error it is a (mostly) one time cost and it has an easy fix on the user’s part. |
That makes total sense! |
Fixed CI 👍 |
Neat! We've been talking about doing this for a while, but we never actually did it 👍 |
Logs an error to the console now instead of silently ignoring errors when a user does not explicitly use the
error
property on ourdata
object.This is one of the error changes we wanted to make for AC 1.0.
Interestingly enough, this change caught a couple of bugs in our test suite 😊
cc @helfer, @martijnwalraven