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:
parent
bed044448c
commit
c16c622b53
|
@ -38,7 +38,7 @@ module DiscourseAi
|
||||||
llm_model.toggle_companion_user
|
llm_model.toggle_companion_user
|
||||||
render json: { ai_persona: LlmModelSerializer.new(llm_model) }, status: :created
|
render json: { ai_persona: LlmModelSerializer.new(llm_model) }, status: :created
|
||||||
else
|
else
|
||||||
render_json_error LlmModelSerializer.new(llm_model)
|
render_json_error llm_model
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ module DiscourseAi
|
||||||
llm_model.toggle_companion_user
|
llm_model.toggle_companion_user
|
||||||
render json: LlmModelSerializer.new(llm_model)
|
render json: LlmModelSerializer.new(llm_model)
|
||||||
else
|
else
|
||||||
render_json_error LlmModelSerializer.new(llm_model)
|
render_json_error llm_model
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ module DiscourseAi
|
||||||
|
|
||||||
render json: LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
|
render json: LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
|
||||||
else
|
else
|
||||||
render_json_error LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
|
render_json_error @ai_persona
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ module DiscourseAi
|
||||||
if @ai_persona.destroy
|
if @ai_persona.destroy
|
||||||
head :no_content
|
head :no_content
|
||||||
else
|
else
|
||||||
render_json_error LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
|
render_json_error @ai_persona
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue