Handling QAnywhere exceptions

The QAnywhere C++, Java, and .NET APIs include special objects and properties for exception handling.

.NET exceptions

The QAException class encapsulates QAnywhere client application exceptions. After you catch a QAnywhere exception, you can use the QAException ErrorCode and Message properties to determine the error code and error message.

Note that if a QAException is thrown inside a message listener delegate and it is not caught in the message listener, then it gets logged to the QAManager log file. Since uncaught QAExceptions are only logged, it is recommended that all exceptions be handled within message listener delegates or handled by exception listener delegates so that they can be dealt with appropriately.

For more information about message listener delegates and exception listener delegates, see:

For more information about the log file, see QAnywhere manager configuration properties.

When a QAException is thrown, the current transaction is rolled back. When this happens in a message listener with a QATransactionalManager, the message that was being processed when the QAException was thrown is put back in the receive queue and so that it can be re-received. You can use the message store property ias_MaxDeliveryAttempts to prevent an infinite loop.

When the property ias_MaxDeliveryAttempts is set to a positive integer n by a QAnywhere application, as in mgr.SetIntStoreProperty( "ias_MaxDeliveryAttempts", 5 ), the QAnywhere client attempts to receive an unacknowledged message up to n times before setting the status of the message to unreceivable. If the property ias_MaxDeliveryAttempts is not set or is negative, the QAnywhere client attempts to receive messages an unlimited number of times.

For more information, see:

C++ exceptions

For C++, the QAError class encapsulates QAnywhere client application exceptions. You can use the QAManagerBase::getLastError() method or QAManagerFactory::getLastError() method to determine the error code associated with the last executed method. You can use the corresponding getLastErrorMessage() method to obtain the error text.

For a list of error codes and more information, see QAError class.

For more information about getLastError and getLastErrorMessage, see:

Java exceptions

The QAException class encapsulates QAnywhere client application exceptions. After you catch a QAnywhere exception, you can use the QAException ErrorCode and Message properties to determine the error code and error message.

If a QAException is thrown inside a message listener and it is not caught in the message listener, then it is logged to the QAManager log file. Since uncaught QAExceptions are only logged, it is recommended that all exceptions be handled within message listeners or handled by exception listeners so that they can be dealt with appropriately.

For more information about message listeners and exception listeners, see:

For more information about the log file, see QAnywhere manager configuration properties.

When a QAException is thrown, the current transaction is rolled back. When this happens in a message listener with a QATransactionalManager, the message that was being processed when the QAException was thrown is put back in the receive queue and so that it can be re-received. You can use the message store property ias_MaxDeliveryAttempts to prevent an infinite loop.

When the property ias_MaxDeliveryAttempts is set to a positive integer n by a QAnywhere application, as in mgr.SetIntStoreProperty( "ias_MaxDeliveryAttempts", 5 ), the QAnywhere client attempts to receive an unacknowledged message up to n times before setting the status of the message to unreceivable. If the property ias_MaxDeliveryAttempts is not set or is negative, the QAnywhere client attempts to receive messages an unlimited number of times.

For more information, see:

Error codes

The following table lists QAnywhere error code values:

Error value

Description

0

No error.

1000

Initialization error.

1001

Termination error.

1002

Unable to access the client properties file.

1003

No destination.

1004

The function is not implemented.

1005

You cannot write to a message as it is in read-only mode.

1006

Error storing a message in the client message store.

1007

Error retrieving a message from the client message store.

1008

Error initializing the background thread.

1009

Error opening a connection to the message store.

1010

There is an invalid property in the client properties file.

1011

Error opening the log file.

1012

Unexpected end of message reached.

1013

The message store is too large relative to the free disk space on the device.

1014

The message store has not been initialized for messaging.

1015

Error getting queue depth.

1016

Cannot use QAManagerBase.getQueueDepth when the message store ID has not been set.

1017

Cannot use QAManagerBase.getQueueDepth on a given destination when filter is ALL.

1018

Error canceling message.

1019

Error canceling message. Cannot cancel a message that has already been sent.

1020

Error acknowledging the message.

1021

The QAManager is not open.

1022

The QAManager is already open.

1023

The given selector has a syntax error.

1024

The timestamp is outside of the acceptable range.

1025

Cannot open QAManager because the maximum number of concurrent server requests is not high enough (see database -gn server option).

1026

Error retrieving property from message store.

1027

Error storing property to message store.