diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-04-26 16:55:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-26 16:55:25 -0400 |
commit | 5b96559df819f496b39acb75c679f6b3d8c8e65d (patch) | |
tree | 95af8543c642f4ddc30982526e022967aac49742 /ext/fg/js/frontend-api-sender.js | |
parent | ca033a87a0d302151b430acfdf9d480514c14aed (diff) |
Error logging refactoring (#454)
* Create new logging methods on yomichan object
* Use new yomichan.logError instead of global logError
* Remove old logError
* Handle unhandledrejection events
* Add addEventListener stub
* Update log function
* Update error conversion to support more types
* Add log event
* Add API log function
* Log errors to the backend
* Make error/warning logs update the badge
* Clear log error indicator on extension button click
* Log correct URL on the background page
* Fix incorrect error conversion
* Remove unhandledrejection handling
Firefox doesn't support it properly.
* Remove unused argument type from log function
* Improve function name
* Change console.warn to yomichan.logWarning
* Move log forwarding initialization into main scripts
Diffstat (limited to 'ext/fg/js/frontend-api-sender.js')
-rw-r--r-- | ext/fg/js/frontend-api-sender.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js index 1d539cab..0ad3f085 100644 --- a/ext/fg/js/frontend-api-sender.js +++ b/ext/fg/js/frontend-api-sender.js @@ -81,12 +81,12 @@ class FrontendApiSender { onAck(id) { const info = this.callbacks.get(id); if (typeof info === 'undefined') { - console.warn(`ID ${id} not found for ack`); + yomichan.logWarning(new Error(`ID ${id} not found for ack`)); return; } if (info.ack) { - console.warn(`Request ${id} already ack'd`); + yomichan.logWarning(new Error(`Request ${id} already ack'd`)); return; } @@ -98,12 +98,12 @@ class FrontendApiSender { onResult(id, data) { const info = this.callbacks.get(id); if (typeof info === 'undefined') { - console.warn(`ID ${id} not found`); + yomichan.logWarning(new Error(`ID ${id} not found`)); return; } if (!info.ack) { - console.warn(`Request ${id} not ack'd`); + yomichan.logWarning(new Error(`Request ${id} not ack'd`)); return; } |