2751 |
20 Oct 06 |
nicklas |
1 |
/** |
2751 |
20 Oct 06 |
nicklas |
$Id$ |
2751 |
20 Oct 06 |
nicklas |
3 |
|
3675 |
16 Aug 07 |
jari |
Copyright (C) 2006 Nicklas Nordborg |
2751 |
20 Oct 06 |
nicklas |
5 |
|
2751 |
20 Oct 06 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
2751 |
20 Oct 06 |
nicklas |
Available at http://base.thep.lu.se/ |
2751 |
20 Oct 06 |
nicklas |
8 |
|
2751 |
20 Oct 06 |
nicklas |
BASE is free software; you can redistribute it and/or |
2751 |
20 Oct 06 |
nicklas |
modify it under the terms of the GNU General Public License |
4479 |
05 Sep 08 |
jari |
as published by the Free Software Foundation; either version 3 |
2751 |
20 Oct 06 |
nicklas |
of the License, or (at your option) any later version. |
2751 |
20 Oct 06 |
nicklas |
13 |
|
2751 |
20 Oct 06 |
nicklas |
BASE is distributed in the hope that it will be useful, |
2751 |
20 Oct 06 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2751 |
20 Oct 06 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2751 |
20 Oct 06 |
nicklas |
GNU General Public License for more details. |
2751 |
20 Oct 06 |
nicklas |
18 |
|
2751 |
20 Oct 06 |
nicklas |
You should have received a copy of the GNU General Public License |
4515 |
11 Sep 08 |
jari |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2751 |
20 Oct 06 |
nicklas |
21 |
*/ |
2751 |
20 Oct 06 |
nicklas |
22 |
package net.sf.basedb.util.error; |
2751 |
20 Oct 06 |
nicklas |
23 |
|
2751 |
20 Oct 06 |
nicklas |
24 |
/** |
2751 |
20 Oct 06 |
nicklas |
A simple error handler that either ignores all errors or |
2751 |
20 Oct 06 |
nicklas |
re-throws them. |
2751 |
20 Oct 06 |
nicklas |
27 |
|
2751 |
20 Oct 06 |
nicklas |
@author nicklas |
2751 |
20 Oct 06 |
nicklas |
@version 2.0 |
2751 |
20 Oct 06 |
nicklas |
@base.modified $Date$ |
2751 |
20 Oct 06 |
nicklas |
31 |
*/ |
2751 |
20 Oct 06 |
nicklas |
32 |
public class SimpleErrorHandler |
2751 |
20 Oct 06 |
nicklas |
33 |
implements ErrorHandler |
2751 |
20 Oct 06 |
nicklas |
34 |
{ |
2751 |
20 Oct 06 |
nicklas |
35 |
|
2751 |
20 Oct 06 |
nicklas |
36 |
private final boolean ignoreAllErrors; |
2751 |
20 Oct 06 |
nicklas |
37 |
|
2751 |
20 Oct 06 |
nicklas |
38 |
/** |
2751 |
20 Oct 06 |
nicklas |
Create a new simple error handler. |
2751 |
20 Oct 06 |
nicklas |
@param ignoreAllErrors TRUE to ignore all errors, FALSE to re-throw them |
2751 |
20 Oct 06 |
nicklas |
41 |
*/ |
2751 |
20 Oct 06 |
nicklas |
42 |
public SimpleErrorHandler(boolean ignoreAllErrors) |
2751 |
20 Oct 06 |
nicklas |
43 |
{ |
2751 |
20 Oct 06 |
nicklas |
44 |
this.ignoreAllErrors = ignoreAllErrors; |
2751 |
20 Oct 06 |
nicklas |
45 |
} |
2751 |
20 Oct 06 |
nicklas |
46 |
|
2751 |
20 Oct 06 |
nicklas |
47 |
/* |
2751 |
20 Oct 06 |
nicklas |
From the ErrorHandler interface |
2751 |
20 Oct 06 |
nicklas |
49 |
------------------------------------------- |
2751 |
20 Oct 06 |
nicklas |
50 |
*/ |
2751 |
20 Oct 06 |
nicklas |
51 |
/** |
2751 |
20 Oct 06 |
nicklas |
Return TRUE if all errors should be ignored, otherwise re-throw the |
2751 |
20 Oct 06 |
nicklas |
throwable. |
2751 |
20 Oct 06 |
nicklas |
54 |
*/ |
6127 |
14 Sep 12 |
nicklas |
55 |
@Override |
2751 |
20 Oct 06 |
nicklas |
56 |
public boolean handleError(Throwable t) |
2751 |
20 Oct 06 |
nicklas |
57 |
throws Throwable |
2751 |
20 Oct 06 |
nicklas |
58 |
{ |
2751 |
20 Oct 06 |
nicklas |
59 |
if (ignoreAllErrors) return true; |
2751 |
20 Oct 06 |
nicklas |
60 |
throw t; |
2751 |
20 Oct 06 |
nicklas |
61 |
} |
2751 |
20 Oct 06 |
nicklas |
62 |
// ------------------------------------------- |
2751 |
20 Oct 06 |
nicklas |
63 |
|
2751 |
20 Oct 06 |
nicklas |
64 |
} |