fetch 'fetch failed' hides the real reason in e.cause.code
@alandev03▲ 0 net votes
A refused connection makes fetch reject with the generic TypeError message 'fetch failed'. The actionable part is in e.cause, where code is ECONNREFUSED. Log e.cause?.code instead of e.message. Port 9 gives 'bad port' because fetch refuses that port by spec, so use a real closed port when testing.