See https://www.woltlab.com/community/thread/295356-load-failed-wenn-keine-netzwerkverbindung-beim-klick-auf-die-benachrichtigungen/
'wcf.global.confirmation.confirm': '{jslang}wcf.global.confirmation.confirm{/jslang}',
'wcf.global.confirmation.title': '{jslang}wcf.global.confirmation.title{/jslang}',
'wcf.global.decimalPoint': '{jslang}wcf.global.decimalPoint{/jslang}',
+ 'wcf.global.error.ajax.network': '{jslang __literal=true}wcf.global.error.ajax.network{/jslang}',
'wcf.global.error.timeout': '{jslang}wcf.global.error.timeout{/jslang}',
'wcf.global.form.error.empty': '{jslang}wcf.global.form.error.empty{/jslang}',
'wcf.global.form.error.greaterThan': '{jslang __literal=true}wcf.global.form.error.greaterThan{/jslang}',
*/
import * as Core from "../Core";
+import * as Language from "../Language";
type ErrorResponsePrevious = {
message: string;
let message = "";
if (error instanceof ConnectionError) {
- message = error.message;
+ // `fetch()` will yield a `TypeError` for network errors and CORS violations.
+ if (error.originalError instanceof TypeError) {
+ message = Language.get("wcf.global.error.ajax.network", { message: error.message });
+ } else {
+ message = error.message;
+ }
} else {
if (error instanceof InvalidJson) {
message = await error.response.clone().text();
* @module WoltLabSuite/Core/Ajax/Error
* @since 5.5
*/
-define(["require", "exports", "tslib", "../Core"], function (require, exports, tslib_1, Core) {
+define(["require", "exports", "tslib", "../Core", "../Language"], function (require, exports, tslib_1, Core, Language) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerGlobalRejectionHandler = exports.InvalidJson = exports.ExpectedJson = exports.StatusNotOk = exports.ConnectionError = exports.ApiError = void 0;
Core = tslib_1.__importStar(Core);
+ Language = tslib_1.__importStar(Language);
async function genericError(error) {
const html = await getErrorHtml(error);
if (html !== "") {
let details = "";
let message = "";
if (error instanceof ConnectionError) {
- message = error.message;
+ // `fetch()` will yield a `TypeError` for network errors and CORS violations.
+ if (error.originalError instanceof TypeError) {
+ message = Language.get("wcf.global.error.ajax.network", { message: error.message });
+ }
+ else {
+ message = error.message;
+ }
}
else {
if (error instanceof InvalidJson) {
<item name="wcf.global.date"><![CDATA[Datum]]></item>
<item name="wcf.global.decimalPoint"><![CDATA[,]]></item>
<item name="wcf.global.description"><![CDATA[Beschreibung]]></item>
+ <item name="wcf.global.error.ajax.network"><![CDATA[<p>Ein Verbindungsaufbau zum Server war nicht möglich, bitte überprüfen Sie Ihre Internetverbindung.</p><p><br></p><p>Fehlermeldung von Ihrem Browser: „{$message}“</p>]]></item>
<item name="wcf.global.error.timeout"><![CDATA[Keine Antwort vom Server erhalten, Anfrage wurde abgebrochen.]]></item>
<item name="wcf.global.error.title"><![CDATA[Fehlermeldung]]></item>
<item name="wcf.global.exception.explanation"><![CDATA[<p class="exceptionSubtitle">Was ist passiert?</p>
<item name="wcf.global.date"><![CDATA[Date]]></item>
<item name="wcf.global.decimalPoint"><![CDATA[.]]></item>
<item name="wcf.global.description"><![CDATA[Description]]></item>
+ <item name="wcf.global.error.ajax.network"><![CDATA[<p>Unable to connect to the server, please check your internet connection.</p><p><br></p><p>Error message from your browser: “{$message}”</p>]]></item>
<item name="wcf.global.error.timeout"><![CDATA[Did not receive a response from server, request aborted.]]></item>
<item name="wcf.global.error.title"><![CDATA[Error Message]]></item>
<item name="wcf.global.exception.explanation"><![CDATA[<p class="exceptionSubtitle">What happened?</p>