2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _EXCEPTIONS_H
2N/A#define _EXCEPTIONS_H
2N/A
2N/A
2N/A
2N/A#include <hbaapi.h>
2N/A#include "Handle.h"
2N/A#include "HBAPort.h"
2N/A#include "Trace.h"
2N/A#include <string>
2N/A
2N/A/**
2N/A * @memo Superclass for all Exception we'll throw.
2N/A *
2N/A * @doc To ensure
2N/A * no uncaught exceptions squeeze through, all exceptions
2N/A * will map to some HBA_STATUS error code so we can easily
2N/A * handle them in catch blocks in our external API.
2N/A */
2N/Aclass HBAException {
2N/Apublic:
2N/A HBAException(HBA_STATUS err) : errorCode(err) {
2N/A Trace log("HBAException");
2N/A log.debug("Error code: %d", err);
2N/A log.stackTrace();
2N/A }
2N/A HBA_STATUS getErrorCode() { return errorCode; }
2N/Aprivate:
2N/A HBA_STATUS errorCode;
2N/A};
2N/A
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Not Supported" error
2N/A */
2N/Aclass NotSupportedException : public HBAException {
2N/Apublic:
2N/A NotSupportedException() : HBAException(HBA_STATUS_ERROR_NOT_SUPPORTED) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Invalid Handle" error
2N/A */
2N/Aclass InvalidHandleException : public HBAException {
2N/Apublic:
2N/A InvalidHandleException() : HBAException(HBA_STATUS_ERROR_INVALID_HANDLE) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Bad Argument" error
2N/A
2N/A */
2N/Aclass BadArgumentException : public HBAException {
2N/Apublic:
2N/A BadArgumentException() : HBAException(HBA_STATUS_ERROR_ARG) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Illegal WWN" error
2N/A */
2N/Aclass IllegalWWNException : public HBAException {
2N/Apublic:
2N/A IllegalWWNException() : HBAException(HBA_STATUS_ERROR_ILLEGAL_WWN) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Illegal Index" error
2N/A */
2N/Aclass IllegalIndexException : public HBAException {
2N/Apublic:
2N/A IllegalIndexException() : HBAException(HBA_STATUS_ERROR_ILLEGAL_INDEX) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "More Data" error
2N/A */
2N/Aclass MoreDataException : public HBAException {
2N/Apublic:
2N/A MoreDataException() : HBAException(HBA_STATUS_ERROR_MORE_DATA) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Stale Data" error
2N/A */
2N/Aclass StaleDataException : public HBAException {
2N/Apublic:
2N/A StaleDataException() : HBAException(HBA_STATUS_ERROR_STALE_DATA) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "SCSI Check Condition" error
2N/A */
2N/Aclass CheckConditionException : public HBAException {
2N/Apublic:
2N/A CheckConditionException() : HBAException(HBA_STATUS_SCSI_CHECK_CONDITION) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Busy" error
2N/A */
2N/Aclass BusyException : public HBAException {
2N/Apublic:
2N/A BusyException() : HBAException(HBA_STATUS_ERROR_BUSY) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Try Again" error
2N/A */
2N/Aclass TryAgainException : public HBAException {
2N/Apublic:
2N/A TryAgainException() : HBAException(HBA_STATUS_ERROR_TRY_AGAIN) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Unavailable" error
2N/A */
2N/Aclass UnavailableException : public HBAException {
2N/Apublic:
2N/A UnavailableException() : HBAException(HBA_STATUS_ERROR_UNAVAILABLE) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "ELS Rejection" error
2N/A */
2N/Aclass ELSRejectException : public HBAException {
2N/Apublic:
2N/A ELSRejectException() : HBAException(HBA_STATUS_ERROR_ELS_REJECT) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Invalid Logical Unit Number" error
2N/A */
2N/Aclass InvalidLUNException : public HBAException {
2N/Apublic:
2N/A InvalidLUNException() : HBAException(HBA_STATUS_ERROR_INVALID_LUN) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Incompatible" error
2N/A */
2N/Aclass IncompatibleException : public HBAException {
2N/Apublic:
2N/A IncompatibleException() : HBAException(HBA_STATUS_ERROR_INCOMPATIBLE) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Ambiguous WWN" error
2N/A */
2N/Aclass AmbiguousWWNException : public HBAException {
2N/Apublic:
2N/A AmbiguousWWNException() : HBAException(HBA_STATUS_ERROR_AMBIGUOUS_WWN) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Not a Target" error
2N/A */
2N/Aclass NotATargetException : public HBAException {
2N/Apublic:
2N/A NotATargetException() : HBAException(HBA_STATUS_ERROR_NOT_A_TARGET) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Unsupported FC4 type" error
2N/A */
2N/Aclass UnsupportedFC4Exception : public HBAException {
2N/Apublic:
2N/A UnsupportedFC4Exception() : HBAException(HBA_STATUS_ERROR_UNSUPPORTED_FC4) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Represents HBA API "Incapable" error
2N/A */
2N/Aclass IncapableException : public HBAException {
2N/Apublic:
2N/A IncapableException() : HBAException(HBA_STATUS_ERROR_INCAPABLE) { }
2N/A};
2N/A
2N/A/**
2N/A * @memo Encapsulate I/O error scenarios.
2N/A *
2N/A * @doc If logging is enabled, this will
2N/A * automatically log the failure with as much detail as possible.
2N/A */
2N/Aclass IOError : public HBAException {
2N/Apublic:
2N/A IOError(std::string message);
2N/A IOError(Handle *handle);
2N/A IOError(HBAPort *port);
2N/A IOError(HBAPort *port, uint64_t target);
2N/A IOError(HBAPort *port, uint64_t target, uint64_t lun);
2N/A};
2N/A
2N/A/**
2N/A * @memo Generic error of unknown type
2N/A *
2N/A * @doc
2N/A * Grab bag for something catastrophic occuring in the internal
2N/A * logic of the VSL. Hopefully, this should never ever happen.
2N/A */
2N/Aclass InternalError : public HBAException {
2N/Apublic:
2N/A InternalError();
2N/A InternalError(std::string message);
2N/A};
2N/A
2N/A#endif /* _EXCEPTIONS_H */