Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 77f7a1d

Browse files
committed
Merge pull request #464 from appirio-tech/sup-1481-java-bridge-reads
Sup 1481 java bridge reads
2 parents 481e020 + 8028713 commit 77f7a1d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

initializers/dataAccess.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ function executePreparedStatement(api, sql, parameters, connection, next, db) {
117117
async.waterfall([
118118
function (cb) {
119119
parameterizeQuery(sql, parameters, cb);
120-
},
121-
function (parametrizedQuery, cb) {
120+
}, function (parametrizedQuery, cb) {
122121
sql = parametrizedQuery;
123122

124123
if (api.helper.readTransaction) {
@@ -135,15 +134,19 @@ function executePreparedStatement(api, sql, parameters, connection, next, db) {
135134

136135
req({ url: javaReadBridge, method: "POST", body: body, json: true }, function(error, response, body) {
137136
if (error) {
138-
cb(error);
137+
return cb(error);
139138
}
140139

141140
if (response.statusCode != 200) {
142-
cb(JSON.stringify(body));
141+
return cb(JSON.stringify(body));
142+
}
143+
144+
if (body.exception) {
145+
return cb("SQL Exception from Java Bridge: " + body.exception);
143146
}
144147

145148
api.log("Response:" + JSON.stringify(body), "debug");
146-
cb(null, body.results);
149+
return cb(null, body.results);
147150
});
148151
} else {
149152
api.log("Database connected", 'debug');

0 commit comments

Comments
 (0)