summaryrefslogtreecommitdiff
path: root/ext/mixed/js/api.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-07 21:36:20 -0500
committerGitHub <noreply@github.com>2021-01-07 21:36:20 -0500
commitb20622b2c84ce3ca1781c7bf8e10fed0af1e5001 (patch)
tree938cdc95f289cdfd482aff77a6ebe44aff80e889 /ext/mixed/js/api.js
parent7d706df66b4cd68d6ac430c2e3e8b9f3a7f4b6ae (diff)
Core refactor (#1207)
* Copy set intersection functions * Remove unused functions * Simplify url check * Remove parseUrl * Simplify stringReverse * Remove hasOwn due to infrequent use * Rename errorToJson/jsonToError to de/serializeError For clarity on intended use. * Fix time argument on timeout * Add missing return value * Throw an error for unexpected argument values * Add documentation comments
Diffstat (limited to 'ext/mixed/js/api.js')
-rw-r--r--ext/mixed/js/api.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js
index 83b5c083..d7cf4ea2 100644
--- a/ext/mixed/js/api.js
+++ b/ext/mixed/js/api.js
@@ -40,7 +40,7 @@ const api = (() => {
yomichan.on('log', async ({error, level, context}) => {
try {
- await this.log(errorToJson(error), level, context);
+ await this.log(serializeError(error), level, context);
} catch (e) {
// NOP
}
@@ -264,7 +264,7 @@ const api = (() => {
break;
case 'error':
cleanup();
- reject(jsonToError(message.data));
+ reject(deserializeError(message.data));
break;
}
};
@@ -317,7 +317,7 @@ const api = (() => {
this._checkLastError(chrome.runtime.lastError);
if (response !== null && typeof response === 'object') {
if (typeof response.error !== 'undefined') {
- reject(jsonToError(response.error));
+ reject(deserializeError(response.error));
} else {
resolve(response.result);
}