demandio / ember-prerender

Make your Ember.js web apps crawlable by rendering static HTML on the server.
MIT License
140 stars 13 forks source link

How can i restart prerender from the page if a fatal JS error is thrown #9

Closed shumkov closed 10 years ago

shumkov commented 10 years ago

May be restart prerender if 500 status code received?

Stanback commented 10 years ago

I've updated the prerender code and added an example to show how the engine is restarted after encountering a fatal JS error.

If you're wanting to restart prerender after an AJAX request returns a 5xx response code, I can think of two options:

  1. Keep the ember-prerender code as-is and catch the error on your Ember.js/Javascript app; you can then throw an exception which prerender will receive (you'll need to make sure Ember doesn't try to catch it)
  2. Update the phantom engine in ember-prerender to call errorCallback() when receiving a onResourceError callback from Phantom

I could make the latter a configuration option if you find it useful.

Stanback commented 10 years ago

Closing this one for now, let me know if you have any issues and I'll re-open.