FIX: properly pass errors to client (#731)

render_json_error expects a AR model not a serializer, using a
serializer eats up the error message
This commit is contained in:
Sam 2024-07-31 17:53:18 +10:00 committed by GitHub
parent bed044448c
commit c16c622b53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ module DiscourseAi
llm_model.toggle_companion_user
render json: { ai_persona: LlmModelSerializer.new(llm_model) }, status: :created
else
render_json_error LlmModelSerializer.new(llm_model)
render_json_error llm_model
end
end
@ -49,7 +49,7 @@ module DiscourseAi
llm_model.toggle_companion_user
render json: LlmModelSerializer.new(llm_model)
else
render_json_error LlmModelSerializer.new(llm_model)
render_json_error llm_model
end
end

View File

@ -63,7 +63,7 @@ module DiscourseAi
render json: LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
else
render_json_error LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
render_json_error @ai_persona
end
end
@ -71,7 +71,7 @@ module DiscourseAi
if @ai_persona.destroy
head :no_content
else
render_json_error LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
render_json_error @ai_persona
end
end