mirror of https://github.com/curbengh/hexo-yam
fix: reject a promise with an error object
- resolve "Unhandled promise rejection" error - https://stackoverflow.com/a/47803880
This commit is contained in:
parent
9df4e8283b
commit
932d36182c
|
@ -120,8 +120,7 @@ function minifySvg () {
|
||||||
if (options.logger) verbose.call(this, assetTxt, data, path, 'svg')
|
if (options.logger) verbose.call(this, assetTxt, data, path, 'svg')
|
||||||
resolve(route.set(path, data))
|
resolve(route.set(path, data))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err)
|
reject(new Error(err))
|
||||||
throw new Error(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -156,8 +155,7 @@ function gzipFn () {
|
||||||
if (options.logger) verbose.call(this, input, result, path, 'gzip')
|
if (options.logger) verbose.call(this, input, result, path, 'gzip')
|
||||||
resolve(route.set(path + '.gz', result))
|
resolve(route.set(path + '.gz', result))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err)
|
reject(new Error(err))
|
||||||
throw new Error(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -191,8 +189,7 @@ function brotliFn () {
|
||||||
if (options.logger) verbose.call(this, input, result, path, 'brotli')
|
if (options.logger) verbose.call(this, input, result, path, 'brotli')
|
||||||
resolve(route.set(path + '.br', result))
|
resolve(route.set(path + '.br', result))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err)
|
reject(new Error(err))
|
||||||
throw new Error(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue