4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
38 * @memo Superclass for all Exception we'll throw.
41 * no uncaught exceptions squeeze through, all exceptions
42 * will map to some HBA_STATUS error code so we can easily
43 * handle them in catch blocks in our external API.
47 HBAException(HBA_STATUS err
) : errorCode(err
) {
48 Trace
log("HBAException");
49 log
.debug("Error code: %d", err
);
52 HBA_STATUS
getErrorCode() { return errorCode
; }
59 * @memo Represents HBA API "Not Supported" error
61 class NotSupportedException
: public HBAException
{
63 NotSupportedException() : HBAException(HBA_STATUS_ERROR_NOT_SUPPORTED
) { }
67 * @memo Represents HBA API "Invalid Handle" error
69 class InvalidHandleException
: public HBAException
{
71 InvalidHandleException() : HBAException(HBA_STATUS_ERROR_INVALID_HANDLE
) { }
75 * @memo Represents HBA API "Bad Argument" error
78 class BadArgumentException
: public HBAException
{
80 BadArgumentException() : HBAException(HBA_STATUS_ERROR_ARG
) { }
84 * @memo Represents HBA API "Illegal WWN" error
86 class IllegalWWNException
: public HBAException
{
88 IllegalWWNException() : HBAException(HBA_STATUS_ERROR_ILLEGAL_WWN
) { }
92 * @memo Represents HBA API "Illegal Index" error
94 class IllegalIndexException
: public HBAException
{
96 IllegalIndexException() : HBAException(HBA_STATUS_ERROR_ILLEGAL_INDEX
) { }
100 * @memo Represents HBA API "More Data" error
102 class MoreDataException
: public HBAException
{
104 MoreDataException() : HBAException(HBA_STATUS_ERROR_MORE_DATA
) { }
108 * @memo Represents HBA API "Stale Data" error
110 class StaleDataException
: public HBAException
{
112 StaleDataException() : HBAException(HBA_STATUS_ERROR_STALE_DATA
) { }
116 * @memo Represents HBA API "SCSI Check Condition" error
118 class CheckConditionException
: public HBAException
{
120 CheckConditionException() : HBAException(HBA_STATUS_SCSI_CHECK_CONDITION
) { }
124 * @memo Represents HBA API "Busy" error
126 class BusyException
: public HBAException
{
128 BusyException() : HBAException(HBA_STATUS_ERROR_BUSY
) { }
132 * @memo Represents HBA API "Try Again" error
134 class TryAgainException
: public HBAException
{
136 TryAgainException() : HBAException(HBA_STATUS_ERROR_TRY_AGAIN
) { }
140 * @memo Represents HBA API "Unavailable" error
142 class UnavailableException
: public HBAException
{
144 UnavailableException() : HBAException(HBA_STATUS_ERROR_UNAVAILABLE
) { }
148 * @memo Represents HBA API "ELS Rejection" error
150 class ELSRejectException
: public HBAException
{
152 ELSRejectException() : HBAException(HBA_STATUS_ERROR_ELS_REJECT
) { }
156 * @memo Represents HBA API "Invalid Logical Unit Number" error
158 class InvalidLUNException
: public HBAException
{
160 InvalidLUNException() : HBAException(HBA_STATUS_ERROR_INVALID_LUN
) { }
164 * @memo Represents HBA API "Incompatible" error
166 class IncompatibleException
: public HBAException
{
168 IncompatibleException() : HBAException(HBA_STATUS_ERROR_INCOMPATIBLE
) { }
172 * @memo Represents HBA API "Ambiguous WWN" error
174 class AmbiguousWWNException
: public HBAException
{
176 AmbiguousWWNException() : HBAException(HBA_STATUS_ERROR_AMBIGUOUS_WWN
) { }
180 * @memo Represents HBA API "Not a Target" error
182 class NotATargetException
: public HBAException
{
184 NotATargetException() : HBAException(HBA_STATUS_ERROR_NOT_A_TARGET
) { }
188 * @memo Represents HBA API "Unsupported FC4 type" error
190 class UnsupportedFC4Exception
: public HBAException
{
192 UnsupportedFC4Exception() : HBAException(HBA_STATUS_ERROR_UNSUPPORTED_FC4
) { }
196 * @memo Represents HBA API "Incapable" error
198 class IncapableException
: public HBAException
{
200 IncapableException() : HBAException(HBA_STATUS_ERROR_INCAPABLE
) { }
204 * @memo Encapsulate I/O error scenarios.
206 * @doc If logging is enabled, this will
207 * automatically log the failure with as much detail as possible.
209 class IOError
: public HBAException
{
211 IOError(std::string message
);
212 IOError(Handle
*handle
);
213 IOError(HBAPort
*port
);
214 IOError(HBAPort
*port
, uint64_t target
);
215 IOError(HBAPort
*port
, uint64_t target
, uint64_t lun
);
219 * @memo Generic error of unknown type
222 * Grab bag for something catastrophic occuring in the internal
223 * logic of the VSL. Hopefully, this should never ever happen.
225 class InternalError
: public HBAException
{
228 InternalError(std::string message
);
231 #endif /* _EXCEPTIONS_H */