Update error messages & codes

This commit is contained in:
Vyr Cossont 2025-01-26 08:41:25 -08:00
parent 1e9646596b
commit 227d6f9719
2 changed files with 6 additions and 6 deletions

View file

@ -368,7 +368,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusMessedUpIntPolicy() {
}`, out) }`, out)
} }
func (suite *StatusCreateTestSuite) TestPostNewScheduledStatus() { func (suite *StatusCreateTestSuite) TestPostNewFutureScheduledStatus() {
out, recorder := suite.postStatus(map[string][]string{ out, recorder := suite.postStatus(map[string][]string{
"status": {"this is a brand new status! #helloworld"}, "status": {"this is a brand new status! #helloworld"},
"spoiler_text": {"hello hello"}, "spoiler_text": {"hello hello"},
@ -383,7 +383,7 @@ func (suite *StatusCreateTestSuite) TestPostNewScheduledStatus() {
// We should have a helpful error message. // We should have a helpful error message.
suite.Equal(`{ suite.Equal(`{
"error": "Not Implemented: scheduled_at is not yet implemented" "error": "Not Implemented: scheduled statuses are not yet supported"
}`, out) }`, out)
} }

View file

@ -107,7 +107,7 @@ func (p *Processor) Create(
if now.Before(scheduledAt) { if now.Before(scheduledAt) {
const errText = "scheduled statuses are not yet supported" const errText = "scheduled statuses are not yet supported"
err := gtserror.New(errText) err := gtserror.New(errText)
return nil, gtserror.NewErrorBadRequest(err, errText) return nil, gtserror.NewErrorNotImplemented(err, errText)
} }
// If not scheduled into the future, this status is being backfilled. // If not scheduled into the future, this status is being backfilled.
@ -168,7 +168,7 @@ func (p *Processor) Create(
if mention.TargetAccountID != requester.ID { if mention.TargetAccountID != requester.ID {
const errText = "statuses mentioning others can't be backfilled" const errText = "statuses mentioning others can't be backfilled"
err := gtserror.New(errText) err := gtserror.New(errText)
return nil, gtserror.NewErrorBadRequest(err, errText) return nil, gtserror.NewErrorForbidden(err, errText)
} }
} }
} }
@ -208,7 +208,7 @@ func (p *Processor) Create(
if backfill { if backfill {
const errText = "statuses with polls can't be backfilled" const errText = "statuses with polls can't be backfilled"
err := gtserror.New(errText) err := gtserror.New(errText)
return nil, gtserror.NewErrorBadRequest(err, errText) return nil, gtserror.NewErrorForbidden(err, errText)
} }
// Process poll, inserting into database. // Process poll, inserting into database.
@ -356,7 +356,7 @@ func (p *Processor) processInReplyTo(
if backfill && requester.ID != inReplyTo.AccountID { if backfill && requester.ID != inReplyTo.AccountID {
const errText = "replies to others can't be backfilled" const errText = "replies to others can't be backfilled"
err := gtserror.New(errText) err := gtserror.New(errText)
return gtserror.NewErrorBadRequest(err, errText) return gtserror.NewErrorForbidden(err, errText)
} }
// Derive pendingApproval status. // Derive pendingApproval status.