Learning XPages Part 41 : Debugging Your Code
Tags : Lotus Domino XPages
Bookmark :
Over the course of the series we have been using some small snippits of JavaScript to compute the values of properties and labels on our XPage. A lot of our JavaScript so far has followed styles that we are familiar with in LotusScript and Formula language but we have had to make some subtle changes so that it would fit within the conventions of the JavaScript language.
When developing your XPage application you may have come across 'Error 500' in your web browser, how it appears to you depends on the web browser you are using.
The normal cause of this error is a problem with your JavaScript code that was executing on the server. The error message above doesn't really help you beyond knowing the fact that there was an error.
If you look at the application properties for your database there is a section for errors and timeouts in the xpages tab. Turn on the 'Display default error page' option.
Now if you save the application properties and refresh your XPage that was giving you the error you should see a much more helpful error page :
It's still not perfect, the page name above is not exactly where the error is. In this case I purposely caused my error in the content_HomePage custom control but the rest of the error message really does help me pinpoint exactly where the error occurred and knowing what line of code caused the error can help you fix it quickly. In this case I used GetColumnValue instead of getColumnValue.
Once your finished your XPages application you may want to turn that application property back off incase a user causes some sort of error. I don't know about you but I'd rather my users didn't see such detailed error messages. I'd prefer to keep it nice and simple for them and the XPages processor allows us to do that also.
Back in the application properties you can select an XPage to be displayed if there is an error. This could be a simple 'An Error Has Occurred, Click here to return to the homepage' type XPage or you could have a form asking the user to enter in what they were doing and then you can email that to the application developer. The options are limitless. here's an option where I redirect to a debug xpage.
My debug page shows me the values of all the session and application scope variables at the time of the error and the page will be included in the next downloadable version of the database.
Bookmark :
Over the course of the series we have been using some small snippits of JavaScript to compute the values of properties and labels on our XPage. A lot of our JavaScript so far has followed styles that we are familiar with in LotusScript and Formula language but we have had to make some subtle changes so that it would fit within the conventions of the JavaScript language.
When developing your XPage application you may have come across 'Error 500' in your web browser, how it appears to you depends on the web browser you are using.
The normal cause of this error is a problem with your JavaScript code that was executing on the server. The error message above doesn't really help you beyond knowing the fact that there was an error.
If you look at the application properties for your database there is a section for errors and timeouts in the xpages tab. Turn on the 'Display default error page' option.
Now if you save the application properties and refresh your XPage that was giving you the error you should see a much more helpful error page :
It's still not perfect, the page name above is not exactly where the error is. In this case I purposely caused my error in the content_HomePage custom control but the rest of the error message really does help me pinpoint exactly where the error occurred and knowing what line of code caused the error can help you fix it quickly. In this case I used GetColumnValue instead of getColumnValue.
Once your finished your XPages application you may want to turn that application property back off incase a user causes some sort of error. I don't know about you but I'd rather my users didn't see such detailed error messages. I'd prefer to keep it nice and simple for them and the XPages processor allows us to do that also.
Back in the application properties you can select an XPage to be displayed if there is an error. This could be a simple 'An Error Has Occurred, Click here to return to the homepage' type XPage or you could have a form asking the user to enter in what they were doing and then you can email that to the application developer. The options are limitless. here's an option where I redirect to a debug xpage.
My debug page shows me the values of all the session and application scope variables at the time of the error and the page will be included in the next downloadable version of the database.
Comments
I have copied all the Parts to ODF & Word doc if you like to add it to your side for download - let me know
Posted by Palmi At 04:20:10 PM On 03/09/2009 | - Website - |
Keep up the good work, and maybe you could create a PDF file and sell it for cheap!!! I know I'd pay to get that PDF, even if all of your articles are available free of charge on your blog.
Posted by Benoit Dubuc At 10:57:17 AM On 03/10/2009 | - Website - |
Posted by Steve At 03:22:20 PM On 03/12/2009 | - Website - |