Skip to content

Commit

Permalink
fix(error message): change error message to display stack and more in…
Browse files Browse the repository at this point in the history
…formation (#1459)
  • Loading branch information
caesarsol committed Oct 22, 2020
1 parent aac795c commit d2c8cdc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/serve-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ const { detectFunctionsBuilder } = require('./detect-functions-builder')

function handleErr(err, response) {
response.statusCode = 500
response.write(`${NETLIFYDEVERR} Function invocation failed: ` + err.toString())
const errorString =
err instanceof Error
? `${err.name}: ${err.message}\n\t${err.stack.join('\n\t')}` // Normal JS error
: `${err.errorType}: ${err.errorMessage}\n\t${err.stackTrace.join('\n\t')}` // Error manipulated by lambda-local
response.write(`Function invocation failed: ${errorString}`)
response.end()
console.log(`${NETLIFYDEVERR} Error during invocation:`, err)
console.log(`${NETLIFYDEVERR} Function invocation failed:`, errorString)
}

function capitalize(t) {
Expand Down

0 comments on commit d2c8cdc

Please sign in to comment.