Handling Responses and TaminoExceptions
The Tamino API for .NET uses two concepts to
inform the application about errors returned from the Tamino XML Server. These
two concepts are described in the following sections:
Return Values and Tamino Messages
Data handling methods in the Tamino API for
.NET, such as inserting, updating, deleting and querying Tamino
documents, can return TaminoResponse
and
TaminoQueryResponse
objects. If a Tamino error occurs,
these methods do not throw a TaminoException
. This is in
order to meet the varying requirements of different kinds of applications. Some
applications might prefer to check for errors using programming language
concepts; others might prefer to use an XSL transformation on the returned
Tamino XML document in order to present the Tamino error messages to their
clients. Whenever a Tamino API for .NET method
returns a TaminoResponse
or
TaminoQueryResponse
object, the application should check
the ReturnValue
property of the class. Methods
that return Stream
or XmlReader
objects also do not throw exceptions for returned Tamino error messages. When
consuming the stream or reader, the application should check for error messages
in the returned documents. For more information about the Tamino response
format, see the Tamino XML Server documentation.
Example
...
TaminoResponse response = command.Update(tamDoc);
if (response.ReturnValue != "0") throw new ApplicationException(response.ErrorText);
...
TaminoExceptions
A method with a return type other than
TaminoResponse
,
TaminoQueryResponse
, Stream
or
XmlReader
will throw a
TaminoException
if the Tamino Server returns an error.
Most of these methods are designed to control flow handling rather than data
handling. TaminoException
is derived from the .NET class
System.ApplicationException
. This allows the application
to access detailed information about the error in the customary .NET way. The
Message
property of the
TaminoException
class will hold the error number and
error text returned from Tamino.
Example
...
try
{
...
TaminoTransaction tx = connection.BeginTransaction();
...
}
catch ( TaminoException e )
{
...
Console.WriteLine(e.Message);
...
}
...
A TaminoExceptions is also thrown when the Tamino API for
.NET discovers an error situation. In this case the
TaminoException
will contain Tamino API for
.NET-specific error numbers and error texts. Error numbers and
texts are listed below:
API (module=PI) Related Messages
TANPIE0001: {0} operation failed: {1}
–
Reason: The specified operation failed for the specified reason. |
TANPIE0005: Unknown database version {0}
–
Reason: Database version is unknown/not handled. |
TANPIE0010: Connection is already in the Open
state.
–
Reason: Another Open request has been attempted on the connection without having done a Close request. |
TANPIE0100: Iterator is closed
–
Reason: Program attempted to use a closed iterator. |
TANPIE0200: Invalid document name {0}
–
Reason: The document name is invalid for the operation. |
TANPIE0201: Document name missing
–
Reason: The document name is missing. |
TANPIE0202: Document type missing
–
Reason: The document type is missing. |
TANPIE0203: Document names differ {0} != {1}
–
Reason: The document names differ between the document and URI. |
TANPIE0204: Document types differ {0} != {1}
–
Reason: The document types differ between the document and URI. |
TANPIE0300: Incorrect ID length. Expected {0}, got
{1}
–
Reason: The length of the ID was incorrect. |
DataSet (module=DS) Related Messages
TANDSE0001: No update information found for query
result
–
Reason: No update information could be found for one or more items in the query result. |
TANDSE0002: Cannot delete or update {0}. Document has
been changed
–
|
TANDSE0003: DataSet schema and Tamino query result do
not match.
–
Reason: The DataSet tables are empty although the Tamino Query result is not. |
TANDSE0004: AutoCommit connection not
allowed.
–
Reason: This operation is not supported for connections with mode AutoCommit. |
TANDSE0005: No support for updates for this kind of
view. No table found for element {0}.
–
Reason: Updates are only supported for complete subtrees of the XML document. The DataSet schema must reflect this subtree. |
TANDSE0006: Query is not of the right format to fill
for updates.
–
Reason: Use TaminoXQueryBuilder.BuildXQuery() to build queries to fill for updates. |
TANDSE0007: Same prefix for different namespaces is not
supported.
–
|
TANDSE0008: Invalid or missing TaminoQueryItemMapping
for table {0}.
–
Reason: The specified columns and/or tables do not exist. |
TANDSE0009: Schema could not be found in
Tamino.
–
|
TANDSE0010: At least one of the specified
TaminoQueryItemMapping did not identify the element uniquely within the Tamino
document.
–
|
TANDSE0011: TaminoAdapterBehavior.ReadOnly not allowed
for this operation.
–
|
Transaction (module=TX) Related Messages
TANTXE0001: Transaction already in progress
–
Reason: Operation is not permitted when a transaction is already in progress. |
TANTXE0002: Transaction not in progress
–
Reason: Operation is only permitted when a transaction is in progress. |
TANTXE0010: Transaction not allowed
–
Reason: Transactions are not allowed in this connection mode. |
Serialization (module=SN) Failures
TANSNE0001: Operation not allowed
–
Reason: You cannot change the content type for XML documents. |
TANSNE0002: The query item is not a document
–
Reason: The item found in the result is only a subtree of the Tamino document. |
Internal Assertion (module=AS) Failures
TANASE0001: Connection is not in Open/Connecting state:
{0}.
–
Reason: Connection is not in the Open/Connecting state. |
TANASE0002: Empty database URL
–
Reason: One of the connection/collection/URL strings is empty or null. |
TANASE0003: Unhandled parameter type {0}
–
Reason: Source not yet implemented in HTTP request handler |
TANASE0004: Command requires query langauge
{0}
–
Reason: The command needs the specified query language in order to be able to work. |
TANASE0005: Response document does not contain object
properties.
–
Reason: The response document does not contain an ino:object element. |