blob: 178e9ea6027b147f8d1a4ff4f11029da1330003a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/**
* <copyright>
*
* Copyright (c) 2005, 2006, 2007 Springsite BV (The Netherlands) and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Taal
* </copyright>
*
* $Id: StoreEclipseException.java,v 1.2 2007/02/01 12:35:18 mtaal Exp $
*/
package org.eclipse.emf.teneo.eclipse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Is used to throw runtime plugin exception.
* This class offers automatic logging to commons logging.
* Note that this class extends RuntimeException, so no forced throws and catch statements.
* Although there are very differing views on this topic but it is our experience that
* to many checked exceptions only distract the programmer and have no added value.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.2 $
*/
public class StoreEclipseException extends RuntimeException
{
/**
* Serializable id
*/
private static final long serialVersionUID = 7433341056815136427L;
/** The logger for all these exceptions */
private static Log log = LogFactory.getLog(StoreEclipseException.class);
/**
* The constructor, logs the exception also
*/
public StoreEclipseException(String msg, Throwable cause)
{
super(msg, cause);
// and log it
log.error(msg, cause);
}
/**
* The constructor, logs the exception also
*/
public StoreEclipseException(String msg)
{
super(msg);
// and log it
log.error(msg, this);
}
}
|