Class ErrorHandler

java.lang.Object
com.vaadin.copilot.CopilotCommand
com.vaadin.copilot.ErrorHandler

public class ErrorHandler extends CopilotCommand
  • Field Details

  • Constructor Details

    • ErrorHandler

      public ErrorHandler()
  • Method Details

    • toJson

      public static com.fasterxml.jackson.databind.node.ArrayNode toJson(Throwable e)
    • setErrorMessage

      public static void setErrorMessage(com.fasterxml.jackson.databind.JsonNode respData, String error)
    • setError

      public static void setError(com.fasterxml.jackson.databind.JsonNode respData, String errorMessage, Throwable e)
    • setError

      public static void setError(com.fasterxml.jackson.databind.JsonNode respData, String errorMessage, Throwable e, ExceptionReportCreator exceptionReportCreator)
    • sendErrorResponse

      public static void sendErrorResponse(com.vaadin.base.devserver.DevToolsInterface devToolsInterface, String command, com.fasterxml.jackson.databind.JsonNode responseData, String error, Throwable e)
      Sends an error message to frontend using dev tools. This method calls sendErrorResponse(DevToolsInterface, String, JsonNode, String, Throwable, ExceptionReportCreator) with null ExceptionReportCreator object
      Parameters:
      devToolsInterface - to send error object
      command - that has failed
      responseData - Response data to fill
      error - Error message
      e - Exception to get stack trace
    • sendErrorResponse

      public static void sendErrorResponse(com.vaadin.base.devserver.DevToolsInterface devToolsInterface, String command, com.fasterxml.jackson.databind.JsonNode responseData, String error, Throwable e, ExceptionReportCreator exceptionReportCreator)
      Constructs an error that will be sent to client via DevToolsInterface. Message is constructed by setError(JsonNode, String, Throwable, ExceptionReportCreator)
      Parameters:
      devToolsInterface - to send error object
      command - that has failed
      responseData - response data that is sent to client
      error - error message
      e - exception to get stack trace
      exceptionReportCreator - report creator to make exceptions reportable to GH. Might be null.
    • handleMessage

      public boolean handleMessage(String command, com.fasterxml.jackson.databind.JsonNode data, com.vaadin.base.devserver.DevToolsInterface devToolsInterface)
      Description copied from class: CopilotCommand
      Called whenever there is a message from the browser. Implementations should check if the command is for them, handle it and return true if the command was handled.
      Specified by:
      handleMessage in class CopilotCommand
      Parameters:
      command - the command to handle
      data - the data for the command
      devToolsInterface - the devtools interface for the connection
      Returns:
      true if the command was handled, false otherwise