001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.snapshot; 019 020import org.apache.hadoop.hbase.DoNotRetryIOException; 021import org.apache.hadoop.hbase.client.SnapshotDescription; 022import org.apache.yetus.audience.InterfaceAudience; 023 024/** 025 * General exception base class for when a snapshot fails. 026 */ 027@SuppressWarnings("serial") 028@InterfaceAudience.Public 029public class HBaseSnapshotException extends DoNotRetryIOException { 030 private SnapshotDescription description; 031 032 /** 033 * Some exception happened for a snapshot and don't even know the snapshot that it was about. 034 * 035 * @param message the full description of the failure 036 */ 037 public HBaseSnapshotException(String message) { 038 super(message); 039 } 040 041 /** 042 * Exception for the given snapshot that has no previous root cause. 043 * 044 * @param message the reason why the snapshot failed 045 * @param snapshotDescription the description of the snapshot that is failing 046 */ 047 public HBaseSnapshotException(String message, SnapshotDescription snapshotDescription) { 048 super(message); 049 this.description = snapshotDescription; 050 } 051 052 /** 053 * Exception for the given snapshot due to another exception. 054 * 055 * @param message the reason why the snapshot failed 056 * @param cause the root cause of the failure 057 * @param snapshotDescription the description of the snapshot that is being failed 058 */ 059 public HBaseSnapshotException(String message, Throwable cause, 060 SnapshotDescription snapshotDescription) { 061 super(message, cause); 062 this.description = snapshotDescription; 063 } 064 065 /** 066 * Exception when the description of the snapshot cannot be determined, due to some root other 067 * root cause. 068 * 069 * @param message description of what caused the failure 070 * @param cause the root cause 071 */ 072 public HBaseSnapshotException(String message, Throwable cause) { 073 super(message, cause); 074 } 075 076 /** 077 * @return the description of the snapshot that is being failed 078 */ 079 public SnapshotDescription getSnapshotDescription() { 080 return this.description; 081 } 082}