Forum Discussion

peterlu's avatar
peterlu
Champion
7 years ago

Styling Lithium Built-in Error Pages

Hi All,

 

I had a customer who is asking to style 404, 403 and "something went wrong" pages. I am able to find 404 page, coz you just type anything into url and you can get 404 page ("page not found").

How can I find these http 403 pages? 403 means Forbidden.

"something went wrong" means exception 500 page?

 

Lithium is so robust. I try to break it to get 500 and 403. But no luck.

Any help? :) Thanks

 

Peter

  • One way I've found to customize these error pages is via text keys. For example, the text key for the "Access Denied" page is: error.PermissionDeniedException.body — this can be adjusted via studio.

  • That would be an interesting customization. Just played around a bit and it seems (unfortunately) that the possibilities in that regard (customizing error pages) are very limited... I thought we might be able to catch an error code in the page init script with http.response.redirectStatus, but this just returns 0 if not explicitly set with http.response.setRedirectStatus(<int_http_status_code>) plus even if we set it we do not have a way to know if an error occured in the page init script because it's never reached once an error occurs. How do I know? I set an error code in the page init script, then provoked a 404 and the error code that is normally set via page init script is again 0, e.g. the init script is never processed in case of an error... keep us updated which rout you gonna take to customize this...

     

    My idea was to redirect to a custom page once I would have determined the error code, but have to forget that idea again =)... maybe DougS  knows some hidden stuff that could be used for that?

  • Hi all, 

     

    Any solution for this? Actually, I'm also looking for the same requirement. We can change the quilt to ErrorPage but I don't  know how to set the status for the ErrorPage to 401 using Page Initialization context objects. 

     

    If anyone finds anything please let me know.