diff --git a/speckle_connector_3/src/actions/handle_error.rb b/speckle_connector_3/src/actions/handle_error.rb index f827fc94..e12a7542 100644 --- a/speckle_connector_3/src/actions/handle_error.rb +++ b/speckle_connector_3/src/actions/handle_error.rb @@ -5,7 +5,10 @@ module Actions # Action to return error message to UI. # It is "TopLevelExceptionHandler" equivalent of C#. class HandleError < Action - # @param error [String] error + # @return [StandardError] error + attr_reader :error + + # @param error [StandardError] error # @param view_name [String] name of the view (binding) # @param action [Action] action that error happened # @param parameters [Array] arguments @@ -21,19 +24,13 @@ def initialize(error, view_name, action, parameters) # @return [States::State] the new updated state object def update_state(state) # TODO: Log here when it is ready!!! - error_message = "Error: #{@error}\nBinding: #{@view_name}\nAction:#{@action}\nArgs: #{@args}\n" - error = { - error: error_message - } - global_notification = { - type: 2, - title: 'Host App Error', - description: error + host_app_error = { + message: error.message, + error: error, + stackTrace: error.backtrace } - js_error_script = "#{@view_name}.receiveResponse('#{@args.first}', #{error.to_json})" - new_state = state.with_add_queue_js_command("error_#{@view_name}", js_error_script) - js_global_notification_script = "#{@view_name}.emit('setGlobalNotification', #{global_notification.to_json})" - new_state.with_add_queue_js_command("global_notification_#{@view_name}", js_global_notification_script) + js_error_script = "#{@view_name}.receiveResponse('#{@args.first}', #{host_app_error.to_json})" + state.with_add_queue_js_command("error_#{@view_name}", js_error_script) end end end