1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.hadoop.hbase.snapshot;
19
20 import org.apache.hadoop.hbase.DoNotRetryIOException;
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.classification.InterfaceStability;
23
24 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
25
26 /**
27 * General exception base class for when a snapshot fails.
28 */
29 @SuppressWarnings("serial")
30 @InterfaceAudience.Public
31 @InterfaceStability.Evolving
32 public class HBaseSnapshotException extends DoNotRetryIOException {
33 private SnapshotDescription description;
34
35 /**
36 * Some exception happened for a snapshot and don't even know the snapshot that it was about.
37 *
38 * @param message the full description of the failure
39 */
40 public HBaseSnapshotException(String message) {
41 super(message);
42 }
43
44 /**
45 * Exception for the given snapshot that has no previous root cause.
46 *
47 * @param message the reason why the snapshot failed
48 * @param snapshotDescription the description of the snapshot that is failing
49 * @deprecated since 1.3.0, will be removed in 3.0.0
50 */
51 @Deprecated
52 public HBaseSnapshotException(String message, SnapshotDescription snapshotDescription) {
53 super(message);
54 this.description = snapshotDescription;
55 }
56
57 /**
58 * Exception for the given snapshot due to another exception.
59 *
60 * @param message the reason why the snapshot failed
61 * @param cause the root cause of the failure
62 * @param snapshotDescription the description of the snapshot that is being failed
63 * @deprecated since 1.3.0, will be removed in 3.0.0
64 */
65 @Deprecated
66 public HBaseSnapshotException(String message, Throwable cause,
67 SnapshotDescription snapshotDescription) {
68 super(message, cause);
69 this.description = snapshotDescription;
70 }
71
72 /**
73 * Exception when the description of the snapshot cannot be determined, due to some root other
74 * root cause.
75 *
76 * @param message description of what caused the failure
77 * @param e the root cause
78 */
79 public HBaseSnapshotException(String message, Exception e) {
80 super(message, e);
81 }
82
83 /**
84 * @return the description of the snapshot that is being failed
85 * @deprecated since 1.3.0, will be removed in 3.0.0
86 */
87 @Deprecated
88 public SnapshotDescription getSnapshotDescription() {
89 return this.description;
90 }
91 }