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 */
018
019package org.apache.hadoop.hbase.backup.impl;
020
021import org.apache.hadoop.hbase.HBaseIOException;
022import org.apache.hadoop.hbase.backup.BackupInfo;
023import org.apache.yetus.audience.InterfaceAudience;
024
025/**
026 * Backup exception
027 */
028@SuppressWarnings("serial")
029@InterfaceAudience.Private
030public class BackupException extends HBaseIOException {
031  private BackupInfo info;
032
033  /**
034   * Some exception happened for a backup and don't even know the backup that it was about
035   * @param msg Full description of the failure
036   */
037  public BackupException(String msg) {
038    super(msg);
039  }
040
041  /**
042   * Some exception happened for a backup with a cause
043   * @param cause the cause
044   */
045  public BackupException(Throwable cause) {
046    super(cause);
047  }
048
049  /**
050   * Exception for the given backup that has no previous root cause
051   * @param msg reason why the backup failed
052   * @param desc description of the backup that is being failed
053   */
054  public BackupException(String msg, BackupInfo desc) {
055    super(msg);
056    this.info = desc;
057  }
058
059  /**
060   * Exception for the given backup due to another exception
061   * @param msg reason why the backup failed
062   * @param cause root cause of the failure
063   * @param desc description of the backup that is being failed
064   */
065  public BackupException(String msg, Throwable cause, BackupInfo desc) {
066    super(msg, cause);
067    this.info = desc;
068  }
069
070  /**
071   * Exception when the description of the backup cannot be determined, due to some other root
072   * cause
073   * @param message description of what caused the failure
074   * @param e root cause
075   */
076  public BackupException(String message, Exception e) {
077    super(message, e);
078  }
079
080  public BackupInfo getBackupInfo() {
081    return this.info;
082  }
083
084}