Skip to content

Commit 0695c3e

Browse files
committed
LUTECE-1885 : AppException, expose all java 1.4 constructors of RuntimeException
1 parent 126c9ca commit 0695c3e

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/java/fr/paris/lutece/portal/service/util/AppException.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
/**
3737
* This kind of exception is thrown when the application encounters a critical problem. This class extends RuntimeException in order to avoid try/catch blocks
38+
* This class forces to write to the logs immediatly to protect against swallowing exceptions.
3839
*/
3940
public class AppException extends RuntimeException
4041
{
@@ -60,19 +61,51 @@ public AppException( String strMessage )
6061
*
6162
* @param strMessage
6263
* The error message
64+
* @param t
65+
* The initial throwable
66+
*/
67+
public AppException( String strMessage, Throwable t )
68+
{
69+
super( strMessage, t );
70+
AppLogService.error( strMessage, this );
71+
}
72+
73+
/**
74+
* Constructor for backwards binary compatibility, same as AppException( String s, Throwable t )
75+
*
76+
* @param strMessage
77+
* The error message
6378
* @param e
6479
* The initial exception
6580
*/
6681
public AppException( String strMessage, Exception e )
6782
{
68-
super( strMessage, e );
69-
AppLogService.error( strMessage, this );
83+
this( strMessage, (Throwable) e );
7084
}
7185

7286
/**
7387
* Constructor 3
7488
*/
7589
public AppException( )
7690
{
91+
AppLogService.error( this );
92+
}
93+
94+
/**
95+
* Constructor 4
96+
*
97+
* @param strMessage
98+
* The error message
99+
* @param e
100+
* The initial exception
101+
* @param enableSuppression
102+
* enableSuppresion
103+
* @param writableStackTrace
104+
* writableStackTrace
105+
*/
106+
public AppException( String strMessage, Throwable t, boolean enableSuppression, boolean writableStackTrace )
107+
{
108+
super( strMessage, t, enableSuppression, writableStackTrace );
109+
AppLogService.error( strMessage, this );
77110
}
78111
}

0 commit comments

Comments
 (0)