2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 package org.collectionspace.services.common.document;
21 * TransactionException
24 public class TransactionException extends DocumentException {
26 // Custom HTTP status code, per the extensibility offered via RFC-2616
27 // e.g. http://tools.ietf.org/html/rfc2616#section-6.1.1
28 final public static int HTTP_CODE = 590;
30 final static String TRANSACTION_FAILED_MSG =
31 "A transaction failed, whether due to exceeding a timeout value or some other cause. Please contact your system administrator.";
34 * Creates a new instance of <code>TransactionException</code> without detail message.
36 public TransactionException() {
37 super(TRANSACTION_FAILED_MSG);
38 setErrorCode(HTTP_CODE);
42 * Constructs an instance of <code>TransactionException</code> with the specified detail message.
43 * @param msg the detail message.
45 public TransactionException(String msg) {
47 setErrorCode(HTTP_CODE);
51 * Constructs a new exception with the specified detail message and
52 * cause. <p>Note that the detail message associated with
53 * <code>cause</code> is <i>not</i> automatically incorporated in
54 * this exception's detail message.
56 * @param message the detail message (which is saved for later retrieval
57 * by the {@link #getMessage()} method).
58 * @param cause the cause (which is saved for later retrieval by the
59 * {@link #getCause()} method). (A <tt>null</tt> value is
60 * permitted, and indicates that the cause is nonexistent or
64 public TransactionException(String message, Throwable cause) {
65 super(message, cause);
66 setErrorCode(HTTP_CODE);
70 * Constructs a new exception with the specified cause and a detail
71 * message of <tt>(cause==null ? null : cause.toString())</tt> (which
72 * typically contains the class and detail message of <tt>cause</tt>).
73 * This constructor is useful for exceptions that are little more than
74 * wrappers for other throwables (for example, {@link
75 * java.security.PrivilegedActionException}).
77 * @param cause the cause (which is saved for later retrieval by the
78 * {@link #getCause()} method). (A <tt>null</tt> value is
79 * permitted, and indicates that the cause is nonexistent or
83 public TransactionException(Throwable cause) {
84 super(TRANSACTION_FAILED_MSG, cause);
85 setErrorCode(HTTP_CODE);