@@ -9,6 +9,7 @@ import { frames } from "./frames";
99import { EventEmitter } from "events" ;
1010import { Container } from "./container" ;
1111import { PeerCertificate } from "tls" ;
12+ import { ConnectionError } from "./errors" ;
1213
1314/**
1415 * Describes the signature of the event handler for any event emitted by rhea.
@@ -472,7 +473,7 @@ export interface EventContext {
472473 */
473474 container : Container ;
474475 /**
475- * @property {Session } session The amqp session link that was created on the amqp connection.
476+ * @property {Session } [ session] The amqp session link that was created on the amqp connection.
476477 */
477478 session ?: Session ;
478479 /**
@@ -493,9 +494,17 @@ export interface EventContext {
493494 */
494495 sender ?: Sender ;
495496 /**
496- * @property {Error } error An optional error object.
497+ * @property {Error | ConnectionError } [error] An optional error object.
498+ * - On `connection_error` event this property will be present. It will have the same information as
499+ * `connection.error` but the type will be `ConnectionError`.
500+ * - An error with SASL will be available through this property, but not through `connection.error`
501+ * (as the amqp connection was never established).
502+ * - On `disconnected` event the context will have an error property that will be of type
503+ * `Error` (or some subclass) as emitted by the underlying socket.
504+ * - The `session_error`, `sender_error` and `receiver_error` events will not have this (`error`)
505+ * property on the EventContext.
497506 */
498- error ?: Error ;
507+ error ?: Error | ConnectionError ;
499508 /**
500509 * @property {boolean } [reconnecting] The value is true if the library is attempting to automatically
501510 * reconnect and false if it has reached the reconnect limit. If reconnect has not been enabled
@@ -546,7 +555,7 @@ export declare interface Connection extends EventEmitter {
546555 open_receiver ( options ?: ReceiverOptions | string ) : Receiver ;
547556 get_option ( name : string , default_value : any ) : any ;
548557 send ( msg : Message ) : Delivery ;
549- get_error ( ) : Error | undefined ;
558+ get_error ( ) : ConnectionError | undefined ;
550559 open ( ) : void ;
551560 close ( error ?: AmqpError ) : void ;
552561 is_open ( ) : boolean ;
0 commit comments