Skip to content

Commit

Permalink
Merge pull request #46 from Jiang-Xuan/fix-downloadIndexhtml-Unhandle…
Browse files Browse the repository at this point in the history
…dPromiseRejectionWarning

Fix download indexhtml unhandled promise rejection warning
  • Loading branch information
Jiang-Xuan authored Nov 4, 2019
2 parents 44e246a + 030f4ff commit e7835ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frondend/downloadIndexHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { DEPLOY_TYPE } = process.env

const bucketName = DEPLOY_TYPE === 'beta' ? 'beta-assets-tuchuang-space' : 'assets-tuchuang-space'

console.log(`当前发布静态资源的环境为: DEPLOY_TYPE: ${DEPLOY_TYPE}, bucketName: ${bucketName}`)
console.log(`downloadIndexHtml.js: 当前发布静态资源的环境为: DEPLOY_TYPE: ${DEPLOY_TYPE}, bucketName: ${bucketName}`)

const client = new Oss({
region: 'oss-cn-hangzhou',
Expand All @@ -24,4 +24,10 @@ const downloadIndexHtml = async () => {
result.stream.pipe(writeStream)
}

process.on('unhandledRejection', (reason, promise) => {
// https://nodejs.org/api/process.html#process_event_unhandledrejection
console.log('Unhandled Rejection at:', promise, 'reason:', reason)
process.exit(1)
})

downloadIndexHtml()

0 comments on commit e7835ae

Please sign in to comment.