feat(jobs): migration 0005 + errs codes for jobs module

This commit is contained in:
2026-05-05 14:09:10 +08:00
parent b8d29d8ea7
commit 967f390b1e
4 changed files with 45 additions and 0 deletions
+13
View File
@@ -66,6 +66,13 @@ const (
// Storage 域
CodeStoragePutFailed Code = "storage.put_failed"
CodeStorageGetFailed Code = "storage.get_failed"
// Jobs 域
CodeJobNotFound Code = "job.not_found"
CodeJobInvalidType Code = "job.invalid_type"
CodeJobPayloadInvalid Code = "job.payload_invalid"
CodeJobPayloadTooLarge Code = "job.payload_too_large"
CodeWebhookNotConfigured Code = "webhook.not_configured"
)
// AppError is the application's structured error type. It carries a stable
@@ -171,6 +178,12 @@ func HTTPStatus(code Code) int {
return http.StatusBadGateway
case CodeLLMContextTooLong:
return http.StatusBadRequest
case CodeJobNotFound:
return http.StatusNotFound
case CodeJobInvalidType, CodeJobPayloadInvalid, CodeJobPayloadTooLarge:
return http.StatusBadRequest
case CodeWebhookNotConfigured:
return http.StatusServiceUnavailable
default:
return http.StatusInternalServerError
}