Skip to content

Commit f993ed7

Browse files
committed
Change failure modes for command API
1 parent 20ac69f commit f993ed7

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/plots/command.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,9 @@ exports.executeAPICommand = function(gd, method, args) {
221221
allArgs.push(args[i]);
222222
}
223223

224-
if(!apiMethod) {
225-
return Promise.reject();
226-
}
227-
228-
return apiMethod.apply(null, allArgs);
224+
return apiMethod.apply(null, allArgs).catch(function (err) {
225+
Lib.warn('API call to Plotly.' + method + ' rejected.', err)
226+
});
229227
};
230228

231229
exports.computeAPICommandBindings = function(gd, method, args) {
@@ -245,9 +243,9 @@ exports.computeAPICommandBindings = function(gd, method, args) {
245243
bindings = computeAnimateBindings(gd, args);
246244
break;
247245
default:
248-
// We'll elect to fail-non-fatal since this is a correct
249-
// answer and since this is not a validation method.
250-
bindings = [];
246+
// This is the case where someone forgot to whitelist and implement
247+
// a new API method, so focus on failing visibly.
248+
throw new Error('Command bindings for Plotly.' + method + ' not implemented');
251249
}
252250
return bindings;
253251
};

0 commit comments

Comments
 (0)