2 * Copyright 2011-2012 BitMeister Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package jp.bitmeister.asn1.exception;
18 import jp.bitmeister.asn1.type.ASN1Type;
21 * The general exception that related to this library and should be caught.
23 * @author WATANABE, Jun. <jwat at bitmeister.jp>
25 @SuppressWarnings("serial")
26 public class ASN1Exception extends Exception {
28 protected DetailedMessage message;
31 * Set detailed message of this exception.
34 * The description of this exception.
36 * The cause exception of this exception.
38 * The ASN.1 type related to this exception.
40 * The element name related to this exception.
42 * The ASN.1 data related to this exception.
44 public void setMessage(String description, Throwable cause,
45 Class<? extends ASN1Type> type, String element, ASN1Type data) {
46 message = new DetailedMessage(description, cause, type, element, data);
52 * @see java.lang.Throwable#getMessage()
55 public String getMessage() {
56 if (message != null) {
57 return message.getMessage();
59 return super.getMessage();
65 * @see java.lang.Throwable#getCause()
68 public Throwable getCause() {
69 return message.getCause();