You've already forked agentic-coding-workflow
feat(chat): migration 0004 + errs codes for chat/llm/storage
This commit is contained in:
@@ -44,6 +44,28 @@ const (
|
||||
CodeWorktreePathInvalid Code = "worktree_path_invalid"
|
||||
CodeGitCredentialInvalid Code = "git_credential_invalid"
|
||||
CodeGitCmdFailed Code = "git_cmd_failed"
|
||||
|
||||
// Chat 模块
|
||||
CodeChatConversationNotFound Code = "chat.conversation_not_found"
|
||||
CodeChatMessageNotFound Code = "chat.message_not_found"
|
||||
CodeChatMessageNotPending Code = "chat.message_not_pending"
|
||||
CodeChatConcurrentMessage Code = "chat.concurrent_message"
|
||||
CodeChatAttachmentTooLarge Code = "chat.attachment_too_large"
|
||||
CodeChatAttachmentUnsupportedMime Code = "chat.attachment_unsupported_mime"
|
||||
CodeChatModelCapabilityMismatch Code = "chat.model_capability_mismatch"
|
||||
CodeChatTemplateNotFound Code = "chat.template_not_found"
|
||||
CodeChatEndpointNotFound Code = "chat.endpoint_not_found"
|
||||
CodeChatModelNotFound Code = "chat.model_not_found"
|
||||
|
||||
// LLM 域
|
||||
CodeLLMUpstream Code = "llm.upstream_error"
|
||||
CodeLLMTimeout Code = "llm.timeout"
|
||||
CodeLLMRateLimited Code = "llm.rate_limited"
|
||||
CodeLLMContextTooLong Code = "llm.context_too_long"
|
||||
|
||||
// Storage 域
|
||||
CodeStoragePutFailed Code = "storage.put_failed"
|
||||
CodeStorageGetFailed Code = "storage.get_failed"
|
||||
)
|
||||
|
||||
// AppError is the application's structured error type. It carries a stable
|
||||
@@ -131,6 +153,24 @@ func HTTPStatus(code Code) int {
|
||||
return http.StatusBadRequest
|
||||
case CodeWorktreeNotHeldByCaller:
|
||||
return http.StatusForbidden
|
||||
case CodeChatConversationNotFound, CodeChatMessageNotFound,
|
||||
CodeChatTemplateNotFound, CodeChatEndpointNotFound, CodeChatModelNotFound:
|
||||
return http.StatusNotFound
|
||||
case CodeChatMessageNotPending, CodeChatConcurrentMessage,
|
||||
CodeChatModelCapabilityMismatch:
|
||||
return http.StatusConflict
|
||||
case CodeChatAttachmentTooLarge:
|
||||
return http.StatusRequestEntityTooLarge
|
||||
case CodeChatAttachmentUnsupportedMime:
|
||||
return http.StatusUnsupportedMediaType
|
||||
case CodeLLMRateLimited:
|
||||
return http.StatusTooManyRequests
|
||||
case CodeLLMTimeout:
|
||||
return http.StatusGatewayTimeout
|
||||
case CodeLLMUpstream, CodeStoragePutFailed, CodeStorageGetFailed:
|
||||
return http.StatusBadGateway
|
||||
case CodeLLMContextTooLong:
|
||||
return http.StatusBadRequest
|
||||
default:
|
||||
return http.StatusInternalServerError
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user