Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c9afafbcec00e1c4a3d8f62a6a4d02b97bb82dca (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
65
66
/*******************************************************************************
 * Copyright (c) 2005, 2015 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.core.databinding;

import java.io.PrintStream;
import java.io.PrintWriter;

/**
 * An unchecked exception indicating a binding problem.
 *
 * @since 1.0
 */
public class BindingException extends RuntimeException {

	/*
	 * Needed because all Throwables are Serializable.
	 */
	private static final long serialVersionUID = -4092828452936724217L;
	private Throwable cause;

	/**
	 * Creates a new BindingException with the given message.
	 *
	 * @param message
	 */
	public BindingException(String message) {
		super(message);
	}

	/**
	 * Creates a new BindingException with the given message and cause.
	 *
	 * @param message
	 * @param cause
	 */
	public BindingException(String message, Throwable cause) {
		super(message);
		this.cause = cause;
	}

	@Override
	public void printStackTrace(PrintStream err) {
		super.printStackTrace(err);
		if (cause != null) {
			err.println("caused by:"); //$NON-NLS-1$
			cause.printStackTrace(err);
		}
	}

	@Override
	public void printStackTrace(PrintWriter err) {
		super.printStackTrace(err);
		if (cause != null) {
			err.println("caused by:"); //$NON-NLS-1$
			cause.printStackTrace(err);
		}
	}
}

Back to the top