2

We are working on Sitecore JSS with react js client side. We need to implement 404 and 500 error pages in Sitecore JSS application. There may be chances of adding multiple Sitecore JSS sites.

How are we handling of 404/500 pages in Sitecore JSS? similar to Sitecore custom code? or any pipeline/processor we need to customize in Sitecore JSS side?

  • It depend on your Client Frameworks, could be nothings to do in Sitecore, handling it in Node.js What Client Frameworks do you use? – Jan Bluemink Mar 12 at 13:44
  • i am using ReactJS – Hussain Mar 12 at 13:45
5

The layout service will return HTTP 404 for items/routes not found in Sitecore. The standard JSS sample applications all key on this an render a not found route. Similarly, for a backend error Layout Service will return HTTP 500.

But that's not the only form of error handling in a JSS app; one need worry about JavaScript errors as well. For that there are many possible implementations depending on what your specific use-case is. For React, check out Error Boundaries which let you bound the scope where an error is handled in React components.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.