Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
applications:custom_errorhandling [2019/08/06 13:04]
admin
applications:custom_errorhandling [2019/08/06 22:40]
admin
Line 20: Line 20:
 </​file>​ </​file>​
  
-So, it's very easy to change the default error handling which shows a popup dialog ​with the error message and some details (stack trace). ​+So, it's very easy to change the default error handling which shows a popup dialog
  
 +{{:​applications:​error_dialog.png?​nolink|}}
 +
 +with the error message and some details (stack trace). \\ 
 +\\ 
 As an example of a custom error handling, we'll show the exceptions directly in the work-screens. So, every work-screen should be able to show error messages. To make this possible, we introduce the following interface: As an example of a custom error handling, we'll show the exceptions directly in the work-screens. So, every work-screen should be able to show error messages. To make this possible, we introduce the following interface:
  
Line 41: Line 45:
     {     {
         labelMain.setText("​ErrorArea"​);​         labelMain.setText("​ErrorArea"​);​
 +        labelMain.setForeground(UIColor.red);​
  
         ...         ...
Line 91: Line 96:
     public void showErrorMessage()     public void showErrorMessage()
     {     {
-        String message = liErrors.get(0).getMessage();​+        String message = ExceptionUtil.getRootCause(liErrors.get(0)).getMessage();​
         ​         ​
         for (IWorkScreen screen : getWorkScreens())         for (IWorkScreen screen : getWorkScreens())
Line 118: Line 123:
 public class FirstWorkScreen extends MyCustomWorkScreen public class FirstWorkScreen extends MyCustomWorkScreen
 </​file>​ </​file>​
 +
 +And the result will look like following:
 +
 +{{:​applications:​error_screen.jpg?​nolink|}}
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information