Make it say Issue not found
This commit is contained in:
parent
fcee34e70d
commit
910d9e537b
3 changed files with 20 additions and 4 deletions
|
|
@ -152,5 +152,6 @@
|
||||||
"settings.theme_light": "Light",
|
"settings.theme_light": "Light",
|
||||||
"settings.theme_dark": "Dark",
|
"settings.theme_dark": "Dark",
|
||||||
"settings.theme_auto": "Auto (per your browser)",
|
"settings.theme_auto": "Auto (per your browser)",
|
||||||
|
"error.issue_not_found": "Issue not found",
|
||||||
"meta.last_line": "Thank you for translating Forgejo! This line isn't seen by the users but it serves other purposes in the translation management. You can place a fun fact in the translation instead of translating it."
|
"meta.last_line": "Thank you for translating Forgejo! This line isn't seen by the users but it serves other purposes in the translation management. You can place a fun fact in the translation instead of translating it."
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
|
||||||
copy_error: {{ctx.Locale.Tr "copy_error"}},
|
copy_error: {{ctx.Locale.Tr "copy_error"}},
|
||||||
error_occurred: {{ctx.Locale.Tr "error.occurred"}},
|
error_occurred: {{ctx.Locale.Tr "error.occurred"}},
|
||||||
network_error: {{ctx.Locale.Tr "error.network_error"}},
|
network_error: {{ctx.Locale.Tr "error.network_error"}},
|
||||||
|
issue_not_found: {{ctx.Locale.Tr "error.issue_not_found"}},
|
||||||
remove_label_str: {{ctx.Locale.Tr "remove_label_str"}},
|
remove_label_str: {{ctx.Locale.Tr "remove_label_str"}},
|
||||||
modal_confirm: {{ctx.Locale.Tr "modal.confirm"}},
|
modal_confirm: {{ctx.Locale.Tr "modal.confirm"}},
|
||||||
modal_cancel: {{ctx.Locale.Tr "modal.cancel"}},
|
modal_cancel: {{ctx.Locale.Tr "modal.cancel"}},
|
||||||
|
|
|
||||||
|
|
@ -95,14 +95,28 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await GET(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`);
|
const response = await GET(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`);
|
||||||
const respJson = await response.json();
|
const respText = await response.text();
|
||||||
|
|
||||||
|
// Necesary to handle stuff like 404 that require other error messages
|
||||||
|
let respJson = {};
|
||||||
|
try {
|
||||||
|
respJson = JSON.parse(respText);
|
||||||
|
} catch {}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
this.i18nErrorMessage = respJson.message ?? i18n.network_error;
|
if (respJson.message) {
|
||||||
|
this.i18nErrorMessage = respJson.message;
|
||||||
|
} else if (response.status === 404) {
|
||||||
|
this.i18nErrorMessage = i18n.issue_not_found;
|
||||||
|
} else {
|
||||||
|
this.i18nErrorMessage = i18n.error_occurred;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.issue = respJson;
|
this.issue = respJson;
|
||||||
} catch {
|
} catch (e) {
|
||||||
this.i18nErrorMessage = i18n.network_error;
|
console.error('Error loading issue info:', e);
|
||||||
|
this.i18nErrorMessage = i18n.error_occurred; // No it is not a network error
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue