Skip to content

Commit

Permalink
nbc handling of request exception rejecting rather than throwing (#119)
Browse files Browse the repository at this point in the history
- [UPDATE] nbc to 1.3.1
- [FIX] undid a fix on a test that hid an actual issue where the request, which returns a promise was also throwing - on deno this doesn't happen and the promise is rejected properly - on node because the function is not async, it actually does throw instead of rejecting the request.
  • Loading branch information
aricart committed Nov 2, 2021
1 parent df205e6 commit 8f580e3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nats.ws",
"version": "1.4.0",
"version": "1.4.1",
"description": "WebSocket NATS client",
"main": "nats.cjs",
"module": "nats.js",
Expand Down
2 changes: 1 addition & 1 deletion src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
setTransportFactory,
Transport,
TransportFactory,
} from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.0/nats-base-client/internal_mod.ts";
} from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.1/nats-base-client/internal_mod.ts";

import { WsTransport } from "./ws_transport.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.0/nats-base-client/mod.ts";
export * from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.1/nats-base-client/mod.ts";
export { connect } from "./connect.ts";
2 changes: 1 addition & 1 deletion src/nats-base-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
* limitations under the License.
*/
// this import here to drive the build system
export * from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.0/nats-base-client/internal_mod.ts";
export * from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.1/nats-base-client/internal_mod.ts";
6 changes: 3 additions & 3 deletions src/ws_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
Server,
ServerInfo,
Transport,
} from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.0/nats-base-client/internal_mod.ts";
} from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.1/nats-base-client/internal_mod.ts";
import {
checkOptions,
DataBuffer,
Expand All @@ -30,9 +30,9 @@ import {
INFO,
NatsError,
render,
} from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.0/nats-base-client/internal_mod.ts";
} from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.3.1/nats-base-client/internal_mod.ts";

const VERSION = "1.4.0";
const VERSION = "1.4.1";
const LANG = "nats.ws";

export class WsTransport implements Transport {
Expand Down
8 changes: 3 additions & 5 deletions test/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,9 @@ test("basics - subject is required", async (t) => {
nc.publish();
}, { code: ErrorCode.BadSubject });

try {
await nc.request();
} catch (err) {
t.is(err.message, "BAD_SUBJECT");
}
await nc.request().catch((err) => {
t.is(err.code, ErrorCode.BadSubject);
});

await nc.close();
await ns.stop();
Expand Down

0 comments on commit 8f580e3

Please sign in to comment.