Skip to content

Commit

Permalink
[Turbopack] print invalid message correctly (#69964)
Browse files Browse the repository at this point in the history
### Why?

'[object: Object]` is not very helpful
  • Loading branch information
sokra authored Sep 11, 2024
1 parent 422a086 commit 843fd86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,10 @@ export default function HotReload({
)
} catch (err: any) {
console.warn(
'[HMR] Invalid message: ' + event.data + '\n' + (err?.stack ?? '')
'[HMR] Invalid message: ' +
JSON.stringify(event.data) +
'\n' +
(err?.stack ?? '')
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export default function connect(mode: 'webpack' | 'turbopack') {
processMessage(payload)
} catch (err: any) {
console.warn(
'[HMR] Invalid message: ' + payload + '\n' + (err?.stack ?? '')
'[HMR] Invalid message: ' +
JSON.stringify(payload) +
'\n' +
(err?.stack ?? '')
)
}
})
Expand Down
5 changes: 4 additions & 1 deletion packages/next/src/client/dev/amp-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ addMessageListener((message) => {
}
} catch (err: any) {
console.warn(
'[HMR] Invalid message: ' + message + '\n' + (err?.stack ?? '')
'[HMR] Invalid message: ' +
JSON.stringify(message) +
'\n' +
(err?.stack ?? '')
)
}
})
Expand Down

0 comments on commit 843fd86

Please # to comment.