Skip to content

Commit a72e2ab

Browse files
committed
Remove LOB writable 'close' event, since only readable Streams have this. Also fix uncaught LOB error.
1 parent e85b69a commit a72e2ab

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/oracledb.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. */
1+
/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. */
22

33
/******************************************************************************
44
*
@@ -62,14 +62,19 @@ Lob.prototype._read = function()
6262
function(err, str)
6363
{
6464
if (err) {
65-
self.close();
65+
self.close(); // Ignore if any error occurs during close
6666
self.emit('error', err);
67+
self.emit('close');
6768
return;
6869
}
6970
self.push(str);
7071
if (!str) {
7172
process.nextTick(function() {
72-
self.close();
73+
err = self.close();
74+
if (err) {
75+
self.emit('error', err);
76+
}
77+
self.emit('close');
7378
});
7479
}
7580
});
@@ -84,7 +89,7 @@ Lob.prototype._write = function(data, encoding, cb)
8489
function(err)
8590
{
8691
if (err) {
87-
self.close();
92+
self.close(); // Ignore if any error occurs during close
8893
return cb(err);
8994
}
9095
cb();
@@ -100,10 +105,14 @@ Lob.prototype.close = function(cb)
100105
}
101106

102107
if (self.iLob != null) {
103-
self.iLob.release();
108+
try {
109+
self.iLob.release();
110+
} catch(err) {
111+
self.iLob = null;
112+
return err;
113+
}
104114
self.iLob = null;
105115
}
106-
self.emit('close');
107116
}
108117

109118
oracledb.Oracledb.prototype.newLob = function(iLob)

0 commit comments

Comments
 (0)