Make the quota error message friendlier

This commit is contained in:
Stanko K.R.
2025-08-25 10:58:48 +02:00
parent c3e0deb57f
commit f9e7aff6e8
@@ -8,7 +8,7 @@ class Conversations::MessagesController < ApplicationController
def create
@conversation.ask(question, **message_params)
rescue Ai::Quota::UsageExceedsQuotaError
render json: { error: "You've asked too many questions this week" }, status: :too_many_requests
render json: { error: "You've depleted your quota" }, status: :too_many_requests
rescue Conversation::InvalidStateError
render json: { error: "Fizzy is still working on an answer to your last question" }, status: :conflict
end