Skip to content

Commit d3ff2bc

Browse files
committed
Improve CloudI API service request exception handling to ensure unrecoverable exceptions and assertions cause the service process to restart. JavaScript will restart when an assertion fails with an AssertionError exception.
1 parent bb86c51 commit d3ff2bc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CloudI.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ CloudI.API.prototype._callback = function (command, name, pattern,
597597
API._terminate = true;
598598
CloudI.stderr_write(err.stack + '\n');
599599
}
600+
else if (err instanceof assert.AssertionError) {
601+
CloudI.stderr_write(err.stack + '\n');
602+
process.exit(1);
603+
}
600604
else {
601605
return_null_response = true;
602606
API._exception(err);
@@ -679,6 +683,10 @@ CloudI.API.prototype._callback = function (command, name, pattern,
679683
else if (err instanceof ForwardSyncException) {
680684
return;
681685
}
686+
else if (err instanceof assert.AssertionError) {
687+
CloudI.stderr_write(err.stack + '\n');
688+
process.exit(1);
689+
}
682690
else {
683691
return_null_response = true;
684692
API._exception(err);

0 commit comments

Comments
 (0)