chore: add explicit info that we can't fix 5xx errors

This commit is contained in:
WebStreamr 2025-07-20 11:37:01 +00:00
parent d1e410ef33
commit 8ad5a8f8e6
No known key found for this signature in database
3 changed files with 36 additions and 2 deletions

View file

@ -207,6 +207,17 @@ describe('resolve', () => {
countryCodes: [CountryCode.de],
},
},
{
url: new URL('https://example5.com'),
format: Format.unknown,
isExternal: true,
error: new HttpError(418, 'I\'m a tea pot', { 'x-foo': 'bar' }),
label: 'hoster.com',
sourceId: '',
meta: {
countryCodes: [CountryCode.de],
},
},
];
}

View file

@ -210,6 +210,11 @@ export class StreamResolver {
if (error instanceof HttpError) {
this.logger.error(`${source}: HTTP status ${error.status} (${error.statusText}), headers: ${JSON.stringify(error.headers)}, stack: ${error.stack}.`, ctx);
if (error.status >= 500) {
return `❌ Remote server has issues. We can't fix this, please try later again.`;
}
return `❌ Request failed with status ${error.status} (${error.statusText}). Request-id: ${ctx.id}.`;
}

View file

@ -100,7 +100,16 @@ exports[`resolve adds error info 1`] = `
"externalUrl": "http://localhost/",
"name": "WebStreamr 🇩🇪",
"title": "🔗 hoster.com
❌ Request failed with status 500 (Internal Server Error). Request-id: test.",
❌ Remote server has issues. We can't fix this, please try later again.",
},
{
"behaviorHints": {
"notWebReady": true,
},
"externalUrl": "http://localhost/",
"name": "WebStreamr 🇩🇪",
"title": "🔗 hoster.com
❌ Request failed with status 418 (I'm a tea pot). Request-id: test.",
},
],
}
@ -206,7 +215,16 @@ exports[`resolve adds error info 2`] = `
"externalUrl": "https://example4.com/",
"name": "WebStreamr 🇩🇪 ⚠️ external",
"title": "🔗 hoster.com
❌ Request failed with status 500 (Internal Server Error). Request-id: test.",
❌ Remote server has issues. We can't fix this, please try later again.",
},
{
"behaviorHints": {
"notWebReady": true,
},
"externalUrl": "https://example5.com/",
"name": "WebStreamr 🇩🇪 ⚠️ external",
"title": "🔗 hoster.com
❌ Request failed with status 418 (I'm a tea pot). Request-id: test.",
},
],
}