Is there a way in Clojurescript create an async function or a macro wrap a function into a Promise to simulate it? My current use-case is to replace the following function that takes a callback by its async version - btw this is for an AWS lambda function.
// Old style
function(args, callback) {
// Use callback(e) for errors
// Use callback(null, value) for the result
}
// New style
async function(args) {
return value; // success path
throw new Error(); // error path
}
Given that this is Clojurescript, using await is not the question. And I know this can simply return a Promise to comply with the async requirement.
So it resolves to some sugar code to create the Promise, catch all errors for me and calling resolve on the happy path or reject otherwise.
Browsing through clojure.core.async and docs -including the clojurescript reference, I haven't found anything.