Skip to content

Commit 02e0b64

Browse files
authored
Merge pull request #102 from amarzavery/disconnect
minor type definition and doc updates
2 parents fad55bf + 776bb4c commit 02e0b64

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ Raised when the remote peer indicates the connection is closed.
336336
##### connection_error
337337

338338
Raised when the remote peer indicates the connection is closed and
339-
specifies an error. A connection_close event will always follow this
340-
event, so it only needs to be implemented if there is specific actions
339+
specifies an error. A `connection_close` event will always follow this
340+
event, so it only needs to be implemented if there are specific actions
341341
to be taken on a close with an error as opposed to a close. The error
342342
is available as a property on the event context.
343343

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rhea",
3-
"version": "0.2.16",
3+
"version": "0.2.17",
44
"description": "reactive AMQP 1.0 library",
55
"homepage": "http://github.com/amqp/rhea",
66
"license": "Apache-2.0",

tsconfig.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
"strict": true,
1010
"declaration": true,
1111
"declarationDir": "./typings",
12-
"lib": [
13-
"dom",
14-
"dom.iterable",
15-
"es5",
16-
"es6",
17-
"es7",
18-
"esnext",
19-
"esnext.asynciterable",
20-
"es2015.iterable"
21-
]
2212
},
2313
"compileOnSave": true,
2414
"include": [

typings/connection.d.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { frames } from "./frames";
99
import { EventEmitter } from "events";
1010
import { Container } from "./container";
1111
import { 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;

typings/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export {
66
EndpointOptions, LinkOptions, ReceiverOptions, SenderOptions, TerminusOptions,
77
ConnectionEvents, MessageHeader, OnAmqpEvent, Source
88
} from "./connection";
9-
export { ConnectionError, ProtocolError, TypeError } from "./errors";
9+
export { ConnectionError, ProtocolError, TypeError, SimpleError } from "./errors";
1010
export { Delivery, Session, SessionEvents } from "./session";
1111
export { message as MessageUtil } from "./message";
1212
export { filter as Filter } from "./filter"

0 commit comments

Comments
 (0)