You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Add error detail when languges fail to load
This will at least log the path that's failing with status code, so we can better confirm the issue. Related to https://github.com/vector-im/element-web/issues/9422
This commit is contained in:
@@ -464,10 +464,14 @@ function getLangsJson(): Promise<object> {
|
|||||||
request(
|
request(
|
||||||
{ method: "GET", url },
|
{ method: "GET", url },
|
||||||
(err, response, body) => {
|
(err, response, body) => {
|
||||||
if (err || response.status < 200 || response.status >= 300) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (response.status < 200 || response.status >= 300) {
|
||||||
|
reject(new Error(`Failed to load ${url}, got ${response.status}`));
|
||||||
|
return;
|
||||||
|
}
|
||||||
resolve(JSON.parse(body));
|
resolve(JSON.parse(body));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -507,10 +511,14 @@ function getLanguage(langPath: string): Promise<object> {
|
|||||||
request(
|
request(
|
||||||
{ method: "GET", url: langPath },
|
{ method: "GET", url: langPath },
|
||||||
(err, response, body) => {
|
(err, response, body) => {
|
||||||
if (err || response.status < 200 || response.status >= 300) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (response.status < 200 || response.status >= 300) {
|
||||||
|
reject(new Error(`Failed to load ${langPath}, got ${response.status}`));
|
||||||
|
return;
|
||||||
|
}
|
||||||
resolve(weblateToCounterpart(JSON.parse(body)));
|
resolve(weblateToCounterpart(JSON.parse(body)));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user