mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user