diffusion
Version:
Diffusion JavaScript client
81 lines (80 loc) • 4.47 kB
JavaScript
"use strict";
/**
* @module diffusion.errors
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorReason = void 0;
var error_reason_1 = require("./../internal/client/error-reason");
var enumerize_1 = require("./../internal/util/enumerize");
/**
* Enum containing reason codes used to report error conditions.
* <p>
* Some common ErrorReason values are defined as global constants. More specific reasons may be defined by
* individual features.
*
* **Example:**
* ```
* // Handle an error from the server
* session.addStream('foo', diffusion.datatypes.string()).on('error', function(e) {
* if (e == diffusion.errors.ACCESS_DENIED) {
* // Handle authorisation error
* } else {
* // Log the problem
* console.log(e);
* }
* });
* ```
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
exports.ErrorReason = {
/** Communication with the server failed. */
COMMUNICATION_FAILURE: new error_reason_1.ErrorReason(100, 'Communication with server failed'),
/** Communication with the server failed because the session is closed. */
SESSION_CLOSED: new error_reason_1.ErrorReason(101, 'Session is closed'),
/** Communication with the server failed because a service request timed out. */
REQUEST_TIME_OUT: new error_reason_1.ErrorReason(102, 'Request time out'),
/** The request was rejected because the caller has insufficient permissions. */
ACCESS_DENIED: new error_reason_1.ErrorReason(103, 'Access denied'),
/** The request was rejected because the requested operation is unsupported for this caller. */
UNSUPPORTED: new error_reason_1.ErrorReason(104, 'Unsupported service'),
/** An application callback threw an exception. Check logs for more information. */
CALLBACK_EXCEPTION: new error_reason_1.ErrorReason(105, 'An application callback threw an exception. Check logs for more information'),
/** An operation failed because invalid data was received. */
INVALID_DATA: new error_reason_1.ErrorReason(106, 'Invalid data'),
/** An operation failed because an addressed session could not be found. */
NO_SUCH_SESSION: new error_reason_1.ErrorReason(107, 'A requested session could not be found'),
/** An operation failed due to using an incompatible data type. */
INCOMPATIBLE_DATATYPE: new error_reason_1.ErrorReason(108, 'Data type is incompatible'),
/** A sent message was not handled by the specified recipient. */
UNHANDLED_MESSAGE: new error_reason_1.ErrorReason(109, 'A message was not handled'),
/**
* A cluster operation failed because partition ownership changed during
* processing.
*
* This is a transient error that occurs while the cluster is recovering
* from failure. The session can retry the operation.
*/
CLUSTER_REPARTITION: new error_reason_1.ErrorReason(110, 'The cluster was repartitioning and the request could not be routed.'),
/**
* A topic update could not be performed because the topic is managed by a
* component (for example,fan-out) which prohibits external updates.
*/
INCOMPATIBLE_STATE: new error_reason_1.ErrorReason(111, 'Topic operation not performed because it is managed by a component that prohibits external updates'),
/**
* A cluster operation failed to be routed to a server within the cluster
* due to a communication failure, or the server that owns a partition is
* not currently known.
*
* This is a transient error that occurs while the cluster is recovering
* from failure. The session can retry the operation.
*/
CLUSTER_ROUTING: new error_reason_1.ErrorReason(112, 'The cluster operation could not be routed.'),
/** A conflicting registration exists on the same branch of the topic tree. */
TOPIC_TREE_REGISTRATION_CONFLICT: new error_reason_1.ErrorReason(200, 'A conflicting registration exists on the same branch of the topic tree'),
/** A conflicting registration exists on the server. */
HANDLER_CONFLICT: new error_reason_1.ErrorReason(201, 'Conflict with an existing handler'),
/** An invalid path was supplied. */
INVALID_PATH: new error_reason_1.ErrorReason(202, 'Invalid path'),
/** A recipient session has rejected a received message request. */
REJECTED_REQUEST: new error_reason_1.ErrorReason(9003, 'A request has been rejected by the recipient session')
};
enumerize_1.enumerize(exports.ErrorReason);