enhance(backend): Improve error handling for scheduled post validation (#16642)

* Initial plan

* Add error definitions and handling for scheduling validation errors

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>

* ✌️

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
Copilot 2025-11-28 17:06:04 +09:00 committed by GitHub
parent bcd9e106e3
commit e44f14115e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 0 deletions

View File

@ -135,6 +135,18 @@ export const meta = {
code: 'CANNOT_RENOTE_TO_EXTERNAL',
id: 'ed1952ac-2d26-4957-8b30-2deda76bedf7',
},
scheduledAtRequired: {
message: 'scheduledAt is required when isActuallyScheduled is true.',
code: 'SCHEDULED_AT_REQUIRED',
id: '15e28a55-e74c-4d65-89b7-8880cdaaa87d',
},
scheduledAtMustBeInFuture: {
message: 'scheduledAt must be in the future.',
code: 'SCHEDULED_AT_MUST_BE_IN_FUTURE',
id: 'e4bed6c9-017e-4934-aed0-01c22cc60ec1',
},
},
limit: {
@ -252,6 +264,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.cannotReplyToSpecifiedVisibilityNoteWithExtendedVisibility);
case 'c3275f19-4558-4c59-83e1-4f684b5fab66':
throw new ApiError(meta.errors.tooManyScheduledNotes);
case '94a89a43-3591-400a-9c17-dd166e71fdfa':
throw new ApiError(meta.errors.scheduledAtRequired);
case 'b34d0c1b-996f-4e34-a428-c636d98df457':
throw new ApiError(meta.errors.scheduledAtMustBeInFuture);
default:
throw err;
}

View File

@ -165,6 +165,18 @@ export const meta = {
code: 'TOO_MANY_SCHEDULED_NOTES',
id: '02f5df79-08ae-4a33-8524-f1503c8f6212',
},
scheduledAtRequired: {
message: 'scheduledAt is required when isActuallyScheduled is true.',
code: 'SCHEDULED_AT_REQUIRED',
id: 'fe9737d5-cc41-498c-af9d-149207307530',
},
scheduledAtMustBeInFuture: {
message: 'scheduledAt must be in the future.',
code: 'SCHEDULED_AT_MUST_BE_IN_FUTURE',
id: 'ed1a6673-d0d1-4364-aaae-9bf3f139cbc5',
},
},
limit: {
@ -295,6 +307,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.containsTooManyMentions);
case 'bacdf856-5c51-4159-b88a-804fa5103be5':
throw new ApiError(meta.errors.tooManyScheduledNotes);
case '94a89a43-3591-400a-9c17-dd166e71fdfa':
throw new ApiError(meta.errors.scheduledAtRequired);
case 'b34d0c1b-996f-4e34-a428-c636d98df457':
throw new ApiError(meta.errors.scheduledAtMustBeInFuture);
default:
throw err;
}