22
33const { inspect } = require ( 'util' )
44
5- const { serialize, prettify } = require ( './serialize ' )
5+ const { serialize, prettify } = require ( './prettify ' )
66
77// Retrieve `message` which sums up all information that can be gathered about
88// the event.
@@ -37,22 +37,25 @@ const defaultGetMessage = function({
3737}
3838
3939const uncaughtException = function ( { error } ) {
40- return `This exception was thrown but not caught: ${ serialize ( error ) } `
40+ return `an exception was thrown but not caught
41+ ${ serialize ( error ) } `
4142}
4243
43- const warning = function ( { error, error : { code, detail = '' } } ) {
44+ const warning = function ( { error, error : { code, detail } } ) {
4445 const codeMessage = code === undefined ? '' : `(${ code } ) `
45- return `${ codeMessage } ${ detail } ${ serialize ( error ) } `
46+ const detailMessage = detail === undefined ? '' : `${ detail } \n`
47+ return `
48+ ${ codeMessage } ${ detailMessage } ${ serialize ( error ) } `
4649}
4750
4851const unhandledRejection = function ( { promiseValue } ) {
49- return `This promise was rejected but not handled: ${ serialize ( promiseValue ) } `
52+ return `a promise was rejected but not handled
53+ ${ serialize ( promiseValue ) } `
5054}
5155
5256const rejectionHandled = function ( { promiseValue } ) {
53- return `This promise was rejected and handled too late: ${ serialize (
54- promiseValue ,
55- ) } `
57+ return `a promise was rejected and handled too late
58+ ${ serialize ( promiseValue ) } `
5659}
5760
5861const multipleResolves = function ( {
@@ -62,12 +65,9 @@ const multipleResolves = function({
6265 secondPromiseValue,
6366} ) {
6467 const again = promiseState === secondPromiseState ? ' again' : ''
65- return `A promise was resolved/rejected multiple times. It was initially ${ promiseState } with: ${ serialize (
66- promiseValue ,
67- ) }
68- It was then ${ secondPromiseState } ${ again } with: ${ serialize (
69- secondPromiseValue ,
70- ) } `
68+ return `a promise was resolved/rejected multiple times
69+ Initially ${ promiseState } with: ${ serialize ( promiseValue ) }
70+ Then ${ secondPromiseState } ${ again } with: ${ serialize ( secondPromiseValue ) } `
7171}
7272
7373const MESSAGES = {
0 commit comments