Error Codes
Error codes are divided into a rough taxonomy which is split between
warnings ("WARN") and errors ("ERR"). The principle difference between
warnings and errors is in how--or if--processing can continue. In general,
it is expected that processing can continue following a warning (provided
the warning can safely be ignored), but processing cannot continue
following an error. In the face of an error, recovery might still be
possible, but this likely requires correcting the source of the
error.
Example
Assume a hypothetical function WriteDataToDisk(), which--surprise!--
writes data to disk. Assume also that this function returns either
- NO_ERROR,
- ERR_NO_DISK_SPACE, or
- WARN_LOW_ON_DISK_SPACE
A call to
WriteDataToDisk() that returns ERR_NO_DISK_SPACE failed to write the
data to disk because there was not enough disk space. Recovery may
be possible--by first freeing sufficient disk space and second by calling
WriteDataToDisk() again. Conversely, a call that returns
WARN_LOW_ON_DISK_SPACE succeeded in writing the data to disk, but
following the write, there was little space left on the disk.
The example above is contrived. In practice, WriteDataToDisk()
would not return warnings, but rather "low disk space" conditions
would be signalled entirely through errors. Warnings are used sparingly,
and are reserved for when a warning cannot be signalled with an error.
Warnings can often be thought of as being informational.
Taxonomy
The following key words are used to indicate the general nature of
the error condition:
Although some of these categories may overlap in meaning, they
are only intended to be rough categories. Some of the examples below are
contrived, but hopefully serve to illustrate the meaning of the category.
-
ALTERED: Something changed that was not supposed to change
-
An internal consistency check has found that some state has
been changed, almost certainly by the user, when it was expected that the
state would remain constant. For instance, if a program is writing
to a file and after writing a large amount of data, the program notices that
the file has been truncated and is 0 bytes long, then the file
has been "altered".
-
BAD: Something was poorly formed or corrupted
-
For example, if a program expects ASCII input but
instead receives as input random
binary data, this input is "bad."
-
ILLEGAL: Something that was prohibited was specified or performed
-
If a function expects as an argument a non-null
pointer, then passing in a null pointer is "illegal."
-
INCONSISTENT: Two or more things that are inconsistent were specified or performed
-
In SET, if the cardholder specifies a purchase price of $10 and
the merchant specifies a purchase price of $25, then these two amounts
are "inconsistent."
-
NO: A resource was missing, lacking, or unavailable
-
Out-of-memory errors are signaled with a NO_MEMORY error.
-
MIN_SIZE, MAX_SIZE: A size/length constraint was violated
-
SET specifies a six-character field to contain the payment card
expiration date (in YYYYMM form). A expiration date specified using
8 digits (perhaps in YYYYMMDD form) violates the maximum length
constraint. Similarly, an expiration date specified using 4 digits
(perhaps in YYMM form) violates the minimum length constraint.
-
UNEXPECTED: Something unexpected was present
-
In SET, certification authorities (CAs) do not participate in the
purchasing sequence, and thus do not receive payment messages.
If some entity sends a payment message to a CA,
the CA will receive an "unexpected" message.
-
UNKNOWN: Something was specified outside the known range of values
-
An unknown value is one that, while well formed, is not part of the
permitted range of values. In other words, a range of possible values
has been enumerated, but the specified value does not appear in that
enumeration. For instance,
say a protocol defines messages of type A, B, and C. A program
implementing this protocol that
receives a message of type D would generate a message type "unknown" error.
-
UNSUPPORTED: Something specified was legal, but unsupported
-
Say that a protocol defines messages of type A, B, and C. However, a
program only supports messages of type A or B. This program, upon
receiving a message of type C, will generate a message type "unsupported"
error.
-
WHILE: An error occured while performing some action
-
A "while" error is a catch-all which signifies that the specific
cause of the error is unavailable (or perhaps it is available through
other means). The functions of the stdio package, for instance, generally
generate errors of the "while" variety: -1 means error while reading
or error while
writing. The specific error type is stored in a global variable named
errno
.
-
WRONG: A value was incorrectly specified
-
In general, a value is "wrong" when it has a single expected value, but
that it was specified with a value other than that expected value.
In SET, request-response message pairs are identified by a request-response
pair identifier (RRPID). If a client recieves a response which contains
an RRPID that is different from the one contained in the request,
then this response RRPID is "wrong."
Copyright © 1996, 1997, Visa International Service Association and MasterCard International Incorporated
All Rights Reserved.