chore: add prefix to rollup errors

This commit is contained in:
Pooya Parsa 2020-11-13 17:13:18 +01:00
parent 2ad4a81362
commit 4d4ae7a115

View File

@ -32,7 +32,10 @@ export async function build (options: SLSOptions) {
options.rollupConfig = getRollupConfig(options)
await hooks.callHook('rollup:before', options)
const build = await rollup(options.rollupConfig)
const build = await rollup(options.rollupConfig).catch((error) => {
error.message = '[serverless] Rollup Error: ' + error.message
throw error
})
const { output } = await build.write(options.rollupConfig.output as OutputOptions)
const size = prettyBytes(output[0].code.length)