mirror of https://github.com/vector-im/riot-web
Merge pull request #6059 from matrix-org/jryans/log-lang-errors
Add error detail when languges fail to loadpull/21833/head
commit
69920c6c91
|
@ -464,10 +464,14 @@ function getLangsJson(): Promise<object> {
|
|||
request(
|
||||
{ method: "GET", url },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
reject(new Error(`Failed to load ${url}, got ${response.status}`));
|
||||
return;
|
||||
}
|
||||
resolve(JSON.parse(body));
|
||||
},
|
||||
);
|
||||
|
@ -507,10 +511,14 @@ function getLanguage(langPath: string): Promise<object> {
|
|||
request(
|
||||
{ method: "GET", url: langPath },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
reject(new Error(`Failed to load ${langPath}, got ${response.status}`));
|
||||
return;
|
||||
}
|
||||
resolve(weblateToCounterpart(JSON.parse(body)));
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue