Skip to content

Commit

Permalink
Fixed #335
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Sep 18, 2018
1 parent ea9dce6 commit 09628ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/client/database/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const Promise = require("bluebird");
const errors = require('../../errors');
const ConnectionError = require('../../errors').ConnectionError;
const RequestError = require('../../errors').RequestError;

class SessionManager {
constructor(client, config) {
Expand Down Expand Up @@ -169,7 +170,7 @@ class SessionManager {
.then(resolve)
.catch((err) => {
// TODO Handle retry
if (err instanceof ConnectionError || err.isTokenException()) {
if (err instanceof ConnectionError || ( err instanceof RequestError && err.isTokenException())) {
this.currentSession = null;
this.open().then(this.withSession.bind(this, op, data, acquire, cbk))
.catch(reject);
Expand Down
6 changes: 5 additions & 1 deletion lib/client/network/protocol37/serializer-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function writeObject(operation, doc) {
}

function writeValue(op, value) {
if (value == null) {
op.writeByte(-1);
return;
}
switch (typeof value) {
case "string":
op.writeByte(7);
Expand All @@ -47,7 +51,7 @@ function writeValue(op, value) {
if (Number.isInteger(value)) {
op.writeByte(3);
op.writeVarint(value);
}else {
} else {
op.writeByte(5);
op.writeDouble(value);
}
Expand Down

0 comments on commit 09628ac

Please sign in to comment.