Releases: binaryage/chromex
0.4.0
Callbacks and errors
We needed a better story for error handling during async api calls. The problem is that Chrome sets chrome.runtime.lastError when an error occurs, but this field is supposed to be checked only inside callbacks. Also Chrome prints an error message into console if it finds that an error has occurred but client code didn't check this lastError
property. As you know, by default, chromex is generating callback code for you and providing core.async channels instead. The problem was that the you as a library user had no easy way how to peek at this property when callback gets executed because core.async channel reading happens later when callback execution already finished.
I decided to always check chrome.runtime.lastError
in generated callbacks and present last error value via chromex.error/get-last-error
. This disables any Chrome "unchecked error" reports in console. Our callback code also optionally reports the error using our own error reporter (which can be configured). Also note that in case of an error the result core.async channel gets closed without receiving any value.
This enables you to write code like this:
(go
(if-let [[tab] (<! (tabs/get tab-id))]
(log "got the tab" tab)
(warn "cannot get the tab" tab-id (get-last-error))))
The if-let
is handy because in case of an error the channel's take operation returns nil
(because channel got closed) and the else branch is executed (which can be optional if you don't want to care about possible errors and want to rely on default callback error reporter to display errors in the console).
You can additionally use a handy macro to mute error reporting if you expect recoverable errors to happen or you prefer to handle them alone:
(go
(with-muted-error-reporting
(if-let [[tab] (<! (tabs/get tab-id))]
(log "got the tab" tab)
(warn "cannot get the tab" tab-id (get-last-error)))))
with-muted-error-reporting
is defined in chromex.config namespace.
API update
Regenerated APIs to match Chromium @ 9f6c8e1.
Notable commits:
2ebb0c3 introduce error handling/reporting subsystem for callbacks
6b245df some helper code moved into library namespaces
1971d47 introduce with-custom-config
macro
b2b3eb3 add tests for callback error handling and reporting
All new changes: v0.3.0...v0.4.0
0.3.0
Improved doc-string generation
Regenerated APIs to match Chromium @ 90f8fcc.
I have improved the way how doc-strings are generated. They newly contain signatures of return values from async calls as well as signatures of events being put on event channels. Also they newly contain direct links into online docs.
I have made Chromex APIs generation more robust during nightly builds and Travis testing infrastructure was improved.
Chromex library now properly recognises recent API additions with assigned pseudo-version :since "master"
. You have to target the latest Chrome APIs if you want to use such bleeding-edge APIs without warnings.
Notable commits:
6a827f7 - do not check missing apis on property access
a069fff - add support for "master" pseudo version
c9bb8ea - generate callback signatures into docstrings
b6ff688 - generate direct links pointing to online docs
42a0d91 - generate signatures and param docs for emitted events
3d7a1a8 - mark parameters without docs or public link as "?"
cc55229 - revisit word wrapping logic to support soft-wrapping for long links
All new changes: v0.2.0...v0.3.0
0.2.0
Support Chrome Apps (Chrome OS)
Regenerated APIs to match Chromium @ 1a87980.
The main addition is generating API namespaces for Chrome Apps. You can find the new APIs under:
https://github.com/binaryage/chromex/tree/master/src/apps
https://github.com/binaryage/chromex/tree/master/src/apps_private
https://github.com/binaryage/chromex/tree/master/src/apps_internal
Including apps namespaces forced me to rename existing namespaces (some API files for extensions and apps have same names). This library is still young so I decided to bite the bullet and break compatibility.
The changes are following:
- all extension namespaces originally located under
chromex.*
were moved underchromex.ext.*
- new apps namespaces are generated under
chromex.app.*
chromex-lib
namespace content was moved intochromex
namespace (now it cannot clash with generated chrome's namespaces because we have full control over second level)
Nothing dramatic, see this commit in chromex-sample.
Notable commits:
91b35cc - add marshalling for storage.StorageArea
9fc5f77 - add ChromePort
tests
All new changes: v0.1.2...v0.2.0
0.1.2
Advanced mode compilation
Proper advanced mode compilation setup, tapping events is more flexible, improved error messages and tests.
Notable commits:
174f401 - init static config from environ variables
7d62c06 - prevent :munged-namespace compiler warnings
36fd5b6 - optional args for .addListener call
791c415 - support for synchronous event listeners
cf23fab - run tests also against advanced compilation mode
1ca6f76 - check for missing API objects early, provide user-friendly errors
All new changes: v0.1.1...v0.1.2
0.1.1
Refactoring and cleanup
All new changes: v0.1.0...v0.1.1