Bug Description
undici >= 7.16.0 emits ErrorEvent with such error property:
{
"name": "TypeError",
"message": ""
}
undici < 7.16.0 emits ErrorEvent with such error property:
{
"name": "Error",
"message": "Received network error or non-101 status code."
}
Reproducible By
import { WebSocket } from 'undici'
import { type TestContext, test } from 'node:test'
test('should emit error event with Error message', { plan: 1 }, (t: TestContext, done): void => {
const webSocket = new WebSocket('https://not-a-ws-server.com/')
webSocket.onerror = ({ error }) => {
done(
t.assert.deepStrictEqual(
{
name: error.name,
message: error.message,
},
{
name: 'Error',
message: 'Received network error or non-101 status code.',
}
)
)
}
})
Expected Behavior
Error should have any message explaining why event occurred.
Logs & Screenshots
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
{
+ message: '',
+ name: 'TypeError'
- message: 'Received network error or non-101 status code.',
- name: 'Error'
}
Environment
Windows, Node v25.3.0
Additional context
MDN doesn't describe WebSocket error event listener argument as ErrorEvent, just plain Event which doesn't have error property.
But since undici uses ErrorEvent, it should have some message, not just an empty string.
Bug Description
undici >= 7.16.0 emits ErrorEvent with such error property:
{ "name": "TypeError", "message": "" }undici < 7.16.0 emits ErrorEvent with such error property:
{ "name": "Error", "message": "Received network error or non-101 status code." }Reproducible By
Expected Behavior
Error should have any message explaining why event occurred.
Logs & Screenshots
Environment
Windows, Node v25.3.0
Additional context
MDN doesn't describe WebSocket error event listener argument as ErrorEvent, just plain Event which doesn't have error property.
But since undici uses ErrorEvent, it should have some message, not just an empty string.