ssorallen / turbo-react

A JavaScript library that transitions between static HTML pages on navigation; no app server required.
https://turbo-react.herokuapp.com/
Apache License 2.0
273 stars 16 forks source link

write to the console in the event TurboReact steps down due to errors #23

Closed sicks closed 9 years ago

sicks commented 9 years ago

console.dir(e) to the rescue!

I think this will be as good as it gets given we're not the ones throwing the error.

ssorallen commented 9 years ago

This should be removed in the production build. It would need to be added to Webpack, something like webpack-strip.

sicks commented 9 years ago

Hmmm. Would there be a way to include it via some kind of debug mode? I'm using rails so I had to build this fork to my forked turbo_react-rails and then bundle that for me to confirm an error was being thrown on my development server.

sicks commented 9 years ago

You learn something new every day. I totally thought console was standard. shakes fist

ssorallen commented 9 years ago

console is standard, but you don't want to ship debugging in production code.

sicks commented 9 years ago

Hmm. I read things saying that some browsers only support it if you've opened the development console, and if you don't it throws errors.

Anywho, I still think it would be helpful if there was some way to know that TurboReact had a problem and returned the baton to Turbolinks, even in production. I ran into this because of content I'd added to my site (apparently bad content in a blog post). If I hadn't already been looking at this source all week (and even then, I only noticed because of that super helpful comment) I'm not sure how I would've ever figured out this was why transitions were failing only some of the time.

Maybe this should just be added to the readme?