diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index f2ac67a1c..4549e9a13 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -348,7 +348,7 @@ class MyModulesController < ApplicationController render json: protocol, serializer: ProtocolSerializer, user: current_user rescue ActiveRecord::RecordInvalid - head :unprocessable_entity + render json: protocol.errors, status: :unprocessable_entity end def results diff --git a/app/javascript/packs/tiny_mce.js b/app/javascript/packs/tiny_mce.js index ed99c76cd..dbf1300a7 100644 --- a/app/javascript/packs/tiny_mce.js +++ b/app/javascript/packs/tiny_mce.js @@ -343,6 +343,8 @@ window.TinyMCE = (() => { editor.setProgressState(0); if (data.status === 403) { HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger'); + } else if (data.status === 422) { + HelperModule.flashAlertMsg(data.responseJSON ? Object.values(data.responseJSON).join(', ') : I18n.t('errors.general'), 'danger'); } });