Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit dc1f541

Browse files
if theres an error, build up an error obj from the res and body
1 parent aef733d commit dc1f541

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,19 @@ Plotly.prototype.deletePlot = function (fid, callback) {
261261
parseRes(res, function (err, body) {
262262

263263
if (res.statusCode === 200) {
264+
264265
var msg = 'Successfully deleted plot: ' + self.username + ':' + fid;
265266
callback(null, msg);
267+
266268
} else {
267-
callback(body); // Pass out the error message from the backend
269+
270+
var errObj = {
271+
statusCode: res.statusCode,
272+
err: body,
273+
statusMessage: res.statusMessage
274+
};
275+
276+
callback(errObj); // Pass out the error message from the backend
268277
}
269278

270279
});

0 commit comments

Comments
 (0)