fix: wait for execution

This commit is contained in:
EnixCoda 2019-02-20 13:40:39 +08:00
parent d9dafee9b8
commit 5d4f92840c
No known key found for this signature in database
GPG key ID: 6825847C88AA329A

View file

@ -1,6 +1,6 @@
import { version } from '../package.json'
import { Middleware } from 'driver/connect.js'
import { IN_PRODUCTION_MODE } from 'env'
import { version } from '../package.json'
// TODO: set this through ENV or something else
const LOG_ENDPOINT = 'https://enix.one/gitako/log'
@ -10,9 +10,9 @@ export function raiseError(error: Error) {
export const withErrorLog: Middleware = function withErrorLog(method, args) {
return [
function() {
async function() {
try {
method.apply(this, arguments)
await method.apply(this, arguments)
} catch (error) {
raiseError(error)
}
@ -34,6 +34,6 @@ function reportError(error: Error) {
error: (error && error.message) || error,
path: window.location.href,
version,
})}`
})}`,
)
}