Skip to content

Commit

Permalink
Better error message in invalid params
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriha-chan committed Feb 24, 2024
1 parent 5832814 commit 2469d45
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 11 deletions.
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ cannotNoteTemporary: "Posting rate limit exceeded"
cannotNoteTemporaryDescription: "Unable to post new notes at the moment. Please wait before trying again."
invalidParamError: "Invalid parameters"
invalidParamErrorDescription: "The request parameters are invalid. This is normally caused by a bug, but may also be due to inputs exceeding size limits or similar."
invalidParamErrorInfoDescription: "The support team or the administrator may ask you to show the debugging information below:"
permissionDeniedError: "Operation denied"
permissionDeniedErrorDescription: "This account does not have the permission to perform this action."
preset: "Preset"
Expand Down
125 changes: 114 additions & 11 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export interface Locale extends ILocale {
*/
"limitToHomeConfirm": string;
/**
* ๅ…ฌ้–‹็ฏ„ๅ›ฒใ‚’ใƒ›ใƒผใƒ ใซๅˆถ้™
* ๅ…ฌ้–‹็ฏ„ๅ›ฒใ‚’ใ€Œใƒ•ใ‚ฉใƒญใƒฏใƒผใ€ใซๅˆถ้™
*/
"limitToFollowers": string;
/**
Expand All @@ -237,11 +237,11 @@ export interface Locale extends ILocale {
*/
"limitToLocalOnlyConfirm": string;
/**
* ๅ…ฌ้–‹็ฏ„ๅ›ฒใ‚’ใ€Œใƒญใƒผใ‚ซใƒซใฎใฟใ€ใซๅˆถ้™
* ใƒชใ‚ขใ‚ฏใ‚ทใƒงใƒณใฎๅ—ใ‘ๅ…ฅใ‚Œใ‚’ใ€Œใ„ใ„ใญใ€ใฎใฟใซๅˆถ้™
*/
"limitToLikeOnly": string;
/**
* ใ“ใฎใƒŽใƒผใƒˆใŒๅ—ใ‘ไป˜ใ‘ใ‚‹ใƒชใ‚ขใ‚ฏใ‚ทใƒงใƒณใ‚’ใƒใƒผใƒˆใฎใฟใซๅˆถ้™ใ—ใพใ™ใ‹๏ผŸใ“ใฎๆ“ไฝœใฏๅ–ใ‚Šๆถˆใ›ใพใ›ใ‚“ใ€‚
* ใ“ใฎใƒŽใƒผใƒˆใŒๅ—ใ‘ไป˜ใ‘ใ‚‹ใƒชใ‚ขใ‚ฏใ‚ทใƒงใƒณใ‚’ใ€Œใ„ใ„ใญใ€ใฎใฟใซๅˆถ้™ใ—ใพใ™ใ‹๏ผŸใ“ใฎๆ“ไฝœใฏๅ–ใ‚Šๆถˆใ›ใพใ›ใ‚“ใ€‚
*/
"limitToLikeOnlyConfirm": string;
/**
Expand Down Expand Up @@ -940,6 +940,14 @@ export interface Locale extends ILocale {
* ใ‚ตใ‚คใƒฌใƒณใ‚นใ—ใŸใ„ใ‚ตใƒผใƒใƒผใฎใƒ›ใ‚นใƒˆใ‚’ๆ”น่กŒใงๅŒบๅˆ‡ใฃใฆ่จญๅฎšใ—ใพใ™ใ€‚ใ‚ตใ‚คใƒฌใƒณใ‚นใ•ใ‚ŒใŸใ‚ตใƒผใƒใƒผใซๆ‰€ๅฑžใ™ใ‚‹ใ‚ขใ‚ซใ‚ฆใƒณใƒˆใฏใ™ในใฆใ€Œใ‚ตใ‚คใƒฌใƒณใ‚นใ€ใจใ—ใฆๆ‰ฑใ‚ใ‚Œใ€ใƒ•ใ‚ฉใƒญใƒผใŒใ™ในใฆใƒชใ‚ฏใ‚จใ‚นใƒˆใซใชใ‚Šใ€ใƒ•ใ‚ฉใƒญใƒฏใƒผใงใชใ„ใƒญใƒผใ‚ซใƒซใ‚ขใ‚ซใ‚ฆใƒณใƒˆใซใฏใƒกใƒณใ‚ทใƒงใƒณใงใใชใใชใ‚Šใพใ™ใ€‚ใƒ–ใƒญใƒƒใ‚ฏใ—ใŸใ‚คใƒณใ‚นใ‚ฟใƒณใ‚นใซใฏๅฝฑ้Ÿฟใ—ใพใ›ใ‚“ใ€‚
*/
"silencedInstancesDescription": string;
/**
* GTLใƒŸใƒฅใƒผใƒˆใ—ใŸใ‚ตใƒผใƒใƒผ
*/
"gtlMutedInstances": string;
/**
* GTLใƒŸใƒฅใƒผใƒˆใ—ใŸใ„ใ‚ตใƒผใƒใƒผใฎใƒ›ใ‚นใƒˆใ‚’ๆ”น่กŒใงๅŒบๅˆ‡ใฃใฆ่จญๅฎšใ—ใพใ™ใ€‚GTLใƒŸใƒฅใƒผใƒˆใ•ใ‚ŒใŸใ‚ตใƒผใƒใƒผใซๆ‰€ๅฑžใ™ใ‚‹ใ‚ขใ‚ซใ‚ฆใƒณใƒˆใซ้–ข้€ฃใ™ใ‚‹ๆŠ•็จฟใŒใ‚ฐใƒญใƒผใƒใƒซใ‚ฟใ‚คใƒ ใƒฉใ‚คใƒณใซ่กจ็คบใ•ใ‚Œใชใใชใ‚Šใพใ™ใ€‚
*/
"gtlMutedInstancesDescription": string;
/**
* ใƒŸใƒฅใƒผใƒˆใจใƒ–ใƒญใƒƒใ‚ฏ
*/
Expand Down Expand Up @@ -1676,6 +1684,10 @@ export interface Locale extends ILocale {
* ่ฟ”ไฟกใ‚’ๅซใ‚€
*/
"withReplies": string;
/**
* ใƒใƒƒใ‚ทใƒฅใ‚ฟใ‚ฐไป˜ใใ‚’ๅซใ‚€
*/
"withHashtags": string;
/**
* ๆฌกใฎใ‚ขใ‚ซใ‚ฆใƒณใƒˆใซๆŽฅ็ถšใ•ใ‚Œใฆใ„ใพใ™
*/
Expand Down Expand Up @@ -1704,6 +1716,10 @@ export interface Locale extends ILocale {
* ใ‚ตใ‚คใƒฌใƒณใ‚น่งฃ้™คใ—ใพใ™ใ‹๏ผŸ
*/
"unsilenceConfirm": string;
/**
* GTLใƒŸใƒฅใƒผใƒˆ
*/
"gtlMuted": string;
/**
* ไบบๆฐ—ใฎใƒฆใƒผใ‚ถใƒผ
*/
Expand Down Expand Up @@ -2772,41 +2788,90 @@ export interface Locale extends ILocale {
* ใ‚ตใƒณใƒ—ใƒซ
*/
"sample": string;
/**
* ็ฎก็†่€…ใซ้€ฃ็ตก
*/
"contactAdmin": string;
/**
* ็†็”ฑใ‚’้ธๆŠž
*/
"contactAdminReason": string;
/**
* ๅ ฑๅ‘Šๅฏพ่ฑกใฎใ‚ขใ‚ซใ‚ฆใƒณใƒˆ
*/
"reportOf": string;
"_contactAdminReason": {
/**
* ไธ้ฉๅˆ‡ใชๆŠ•็จฟ
*/
"abuse": string;
/**
* ใ‚นใƒ‘ใƒ ใ‚’ๆŠ•็จฟใ—ใฆใ„ใพใ™
*/
"spam": string;
/**
* ใƒ—ใƒฉใ‚คใƒใ‚ทใƒผใ‚’ไพตๅฎณใ—ใฆใ„ใพใ™
*/
"privacy": string;
/**
* ๆšด่จ€ใ‚„ๅ€‹ไบบๆ”ปๆ’ƒใ‚’ใ—ใฆใ„ใพใ™
*/
"attack": string;
/**
* ้ฉๅˆ‡ใช้–ฒ่ฆงๆณจๆ„ใ‚ฟใ‚ฐใŒใคใ„ใฆใ„ใพใ›ใ‚“
*/
"obscene": string;
/**
* ใใฎใปใ‹ใฎ็†็”ฑใงไธ้ฉๅˆ‡ใงใ™
*/
"abuseOther": string;
/**
* ๅŠฉใ‘ใŒๅฟ…่ฆ
*/
"help": string;
/**
* ๆŠ€่ก“็š„ใชๅŠฉใ‘ใŒๅฟ…่ฆใงใ™
*/
"technical": string;
/**
* ็ฒพ็ฅž็š„ใชๅŠฉใ‘ใŒๅฟ…่ฆใงใ™
*/
"mental": string;
/**
* ใƒ•ใ‚ฃใƒซใ‚ฟใƒผใซ่ชคๆคœ็Ÿฅใ•ใ‚Œใฆใ„ใพใ™
*/
"falsePositive": string;
/**
* ใใฎใปใ‹ใฎๅŠฉใ‘ใŒๅฟ…่ฆใงใ™
*/
"helpOther": string;
/**
* ็ด ๆ™ดใ‚‰ใ—ใ„ๆŠ•็จฟ
*/
"good": string;
/**
* ๅ–„ใ„่กŒใ„ใ‚’ใ—ใฆใ„ใพใ™
*/
"ethical": string;
};
/**
* ใƒฆใƒผใ‚ถใƒผใฎๅ ฑๅ‘Šใ‚’็ขบ่ช
*/
"reviewReports": string;
"fillReportDescription": string;
"reportCompleted": string;
/**
* ้€šๅ ฑ
* ็ฎก็†่€…ใซไผใˆใŸใ„ๆƒ…ๅ ฑใฎ่ฉณ็ดฐใ‚’ๅ…ฅๅŠ›ใ—ใฆใใ ใ•ใ„
*/
"abuseReports": string;
"fillReportDescription": string;
/**
* ้€šๅ ฑ
* ๅ ฑๅ‘ŠใŒ้€ไฟกใ•ใ‚Œใพใ—ใŸใ€‚ใ‚ใ‚ŠใŒใจใ†ใ”ใ–ใ„ใพใ™by ็ฎก็†่€…
*/
"reportAbuse": string;
"reportCompleted": string;
/**
* ใƒชใƒŽใƒผใƒˆใ‚’้€šๅ ฑ
* ใƒชใƒŽใƒผใƒˆ่กŒ็‚บใซใคใ„ใฆ็ฎก็†่€…ใซ้€ฃ็ตก
*/
"reportAbuseRenote": string;
/**
* ้€šๅ ฑ่€…
* ๅ ฑๅ‘Š่€…
*/
"reporter": string;
/**
Expand Down Expand Up @@ -4077,6 +4142,14 @@ export interface Locale extends ILocale {
* ๆ“ไฝœๅ›žๆ•ฐใŒๅˆถ้™ใ‚’่ถ…้Žใ™ใ‚‹ใŸใ‚ไธ€ๆ™‚็š„ใซๅˆฉ็”จใงใใพใ›ใ‚“ใ€‚ใ—ใฐใ‚‰ใๆ™‚้–“ใ‚’็ฝฎใ„ใฆใ‹ใ‚‰ๅ†ๅบฆใŠ่ฉฆใ—ใใ ใ•ใ„ใ€‚
*/
"cannotPerformTemporaryDescription": string;
/**
* ๆŠ•็จฟ้€ŸๅบฆใŒ้€Ÿใ™ใŽใพใ™
*/
"cannotNoteTemporary": string;
/**
* ็Ÿญๆ™‚้–“ใซๅคšใใฎๆŠ•็จฟใ‚’่กŒใฃใŸใŸใ‚ใ€ๆŠ•็จฟ้€Ÿๅบฆๅˆถ้™(ใƒฌใƒผใƒˆใƒชใƒŸใƒƒใƒˆ)ใ‚’่ถ…ใˆใพใ—ใŸใ€‚ใ—ใฐใ‚‰ใๆ™‚้–“ใ‚’็ฝฎใ„ใฆใ‹ใ‚‰ๆŠ•็จฟใ—ใฆใใ ใ•ใ„ใ€‚
*/
"cannotNoteTemporaryDescription": string;
/**
* ใƒ‘ใƒฉใƒกใƒผใ‚ฟใ‚จใƒฉใƒผ
*/
Expand All @@ -4085,6 +4158,10 @@ export interface Locale extends ILocale {
* ใƒชใ‚ฏใ‚จใ‚นใƒˆใƒ‘ใƒฉใƒกใƒผใ‚ฟใซๅ•้กŒใŒใ‚ใ‚Šใพใ™ใ€‚้€šๅธธใ“ใ‚Œใฏใƒใ‚ฐใงใ™ใŒใ€ๅ…ฅๅŠ›ใ—ใŸๆ–‡ๅญ—ๆ•ฐใŒๅคšใ™ใŽใ‚‹็ญ‰ใฎๅฏ่ƒฝๆ€งใ‚‚ใ‚ใ‚Šใพใ™ใ€‚
*/
"invalidParamErrorDescription": string;
/**
* ไปฅไธ‹ใฎๆƒ…ๅ ฑใ‚’ใ‚ตใƒใƒผใƒˆใ‚„็ฎก็†่€…ใซ่ฆ‹ใ›ใ‚‹ใจ่งฃๆฑบใ™ใ‚‹ใ‹ใ‚‚ใ—ใ‚Œใพใ›ใ‚“ใ€‚
*/
"invalidParamErrorInfoDescription": string;
/**
* ๆ“ไฝœใŒๆ‹’ๅฆใ•ใ‚Œใพใ—ใŸ
*/
Expand Down Expand Up @@ -4321,6 +4398,10 @@ export interface Locale extends ILocale {
* ใƒ‡ใƒผใ‚ฟใ‚ปใƒผใƒใƒผ
*/
"dataSaver": string;
/**
* ๅŸ‹ใ‚่พผใฟใ‚ณใƒผใƒ‰ใ‚’ใ‚ณใƒ”ใƒผ
*/
"copyEmbedCode": string;
/**
* ใ‚ขใ‚ซใ‚ฆใƒณใƒˆใฎ็งป่กŒ
*/
Expand Down Expand Up @@ -6425,6 +6506,10 @@ export interface Locale extends ILocale {
* ใƒ‘ใƒ–ใƒชใƒƒใ‚ฏๆŠ•็จฟใฎ่จฑๅฏ
*/
"canPublicNote": string;
/**
* ใƒŽใƒผใƒˆๅ†…ใฎๆœ€ๅคงใƒกใƒณใ‚ทใƒงใƒณๆ•ฐ
*/
"mentionMax": string;
/**
* ใ‚ตใƒผใƒใƒผๆ‹›ๅพ…ใ‚ณใƒผใƒ‰ใฎ็™บ่กŒ
*/
Expand Down Expand Up @@ -7057,6 +7142,24 @@ export interface Locale extends ILocale {
*/
"heading": string;
};
"_instanceGtlMute": {
/**
* ใƒŸใƒฅใƒผใƒˆใ—ใŸใ‚ตใƒผใƒใƒผใ‹ใ‚‰ใฎๆŠ•็จฟใ‚’ใ‚ฐใƒญใƒผใƒใƒซใ‚ฟใ‚คใƒ ใƒฉใ‚คใƒณใซ่กจ็คบใ—ใพใ›ใ‚“ใ€‚ใใฎไป–ใฎใ‚ฟใ‚คใƒ ใƒฉใ‚คใƒณใงใฏ่กจ็คบใ•ใ‚Œใพใ™ใ€‚
*/
"instanceMuteDescription": string;
/**
* ๆ”น่กŒใงๅŒบๅˆ‡ใฃใฆ่จญๅฎšใ—ใพใ™
*/
"instanceMuteDescription2": string;
/**
* ่จญๅฎšใ—ใŸใ‚ตใƒผใƒใƒผใฎใƒŽใƒผใƒˆใ‚’ใ‚ฐใƒญใƒผใƒใƒซใ‚ฟใ‚คใƒ ใƒฉใ‚คใƒณใ‹ใ‚‰้š ใ—ใพใ™ใ€‚
*/
"title": string;
/**
* GTLใƒŸใƒฅใƒผใƒˆใ™ใ‚‹ใ‚ตใƒผใƒใƒผ
*/
"heading": string;
};
"_theme": {
/**
* ใƒ†ใƒผใƒžใ‚’ๆŽขใ™
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ cannotNoteTemporary: "ๆŠ•็จฟ้€ŸๅบฆใŒ้€Ÿใ™ใŽใพใ™"
cannotNoteTemporaryDescription: "็Ÿญๆ™‚้–“ใซๅคšใใฎๆŠ•็จฟใ‚’่กŒใฃใŸใŸใ‚ใ€ๆŠ•็จฟ้€Ÿๅบฆๅˆถ้™(ใƒฌใƒผใƒˆใƒชใƒŸใƒƒใƒˆ)ใ‚’่ถ…ใˆใพใ—ใŸใ€‚ใ—ใฐใ‚‰ใๆ™‚้–“ใ‚’็ฝฎใ„ใฆใ‹ใ‚‰ๆŠ•็จฟใ—ใฆใใ ใ•ใ„ใ€‚"
invalidParamError: "ใƒ‘ใƒฉใƒกใƒผใ‚ฟใ‚จใƒฉใƒผ"
invalidParamErrorDescription: "ใƒชใ‚ฏใ‚จใ‚นใƒˆใƒ‘ใƒฉใƒกใƒผใ‚ฟใซๅ•้กŒใŒใ‚ใ‚Šใพใ™ใ€‚้€šๅธธใ“ใ‚Œใฏใƒใ‚ฐใงใ™ใŒใ€ๅ…ฅๅŠ›ใ—ใŸๆ–‡ๅญ—ๆ•ฐใŒๅคšใ™ใŽใ‚‹็ญ‰ใฎๅฏ่ƒฝๆ€งใ‚‚ใ‚ใ‚Šใพใ™ใ€‚"
invalidParamErrorInfoDescription: "ไปฅไธ‹ใฎๆƒ…ๅ ฑใ‚’ใ‚ตใƒใƒผใƒˆใ‚„็ฎก็†่€…ใซ่ฆ‹ใ›ใ‚‹ใจ่งฃๆฑบใ™ใ‚‹ใ‹ใ‚‚ใ—ใ‚Œใพใ›ใ‚“ใ€‚"
permissionDeniedError: "ๆ“ไฝœใŒๆ‹’ๅฆใ•ใ‚Œใพใ—ใŸ"
permissionDeniedErrorDescription: "ใ“ใฎใ‚ขใ‚ซใ‚ฆใƒณใƒˆใซใฏใ“ใฎๆ“ไฝœใ‚’่กŒใ†ใŸใ‚ใฎๆจฉ้™ใŒใ‚ใ‚Šใพใ›ใ‚“ใ€‚"
preset: "ใƒ—ใƒชใ‚ปใƒƒใƒˆ"
Expand Down
7 changes: 7 additions & 0 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,13 @@ async function post(ev?: MouseEvent) {
if (err.code === "RATE_LIMIT_EXCEEDED") {
title = i18n.ts.cannotNoteTemporary;
text = i18n.ts.cannotNoteTemporaryDescription;
} else if (err.code === "INVALID_PARAM") {
title = i18n.ts.invalidParamError;
text = i18n.ts.invalidParamErrorDescription;
if ((err as any).info) {
text += i18n.ts.invalidParamErrorInfoDescription;
text += '\n' + JSON.stringify((err as any).info);
}
} else {
title = "Cannot post";
text = err.message + '\n' + (err as any).id;
Expand Down

0 comments on commit 2469d45

Please sign in to comment.