return message_;
}
+ void SetMessage(const std::string& message) {
+ message_ = message;
+ }
+
+ void SetMessage(std::string&& message) {
+ message_ = std::move(message);
+ }
+
bool IsSuccess() const {
return error_code() == ErrorCode::NO_ERROR;
}
Utils.prototype.error = console.error.bind(console);
Utils.prototype.warn = console.warn.bind(console);
Utils.prototype.log = _enableJsLogs ? console.log.bind(console) : function() {};
+Utils.prototype.assert = console.assert.bind(console);
Utils.prototype.global = _global;
return new WebAPIException(result.error);
};
+/*
+ * This function checks if the reported error's name is in valid_error_names.
+ * If so, it is returned. Otherwise, default_error is returned.
+ * valid_error_names should contain error names defined in the API reference
+ * for the called function.
+ */
+NativeManager.prototype.getErrorObjectAndValidate = function(result,
+ valid_error_names,
+ default_error) {
+ xwalk.utils.assert(Array.isArray(valid_error_names),
+ "valid_error_names must be an Array. %s was passed instead",
+ typeof valid_error_names);
+ var error = new WebAPIException(result.error);
+ if (valid_error_names.includes(error.name)) {
+ return error;
+ }
+
+ return default_error;
+};
+
NativeManager.prototype.callIfPossible = function(callback) {
if (!_type.isNullOrUndefined(callback)) {
callback.apply(callback, [].slice.call(arguments, 1));