Package com.vaadin.copilot
Class ErrorHandler
java.lang.Object
com.vaadin.copilot.CopilotCommand
com.vaadin.copilot.ErrorHandler
-
Field Summary
FieldsFields inherited from class com.vaadin.copilot.CopilotCommand
currentSession, KEY_CANCEL_REQ_ID, KEY_REQ_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleMessage(String command, com.fasterxml.jackson.databind.JsonNode data, com.vaadin.base.devserver.DevToolsInterface devToolsInterface) Called whenever there is a message from the browser.static voidsendErrorResponse(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.static voidsendErrorResponse(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 viaDevToolsInterface.static voidstatic voidsetError(com.fasterxml.jackson.databind.JsonNode respData, String errorMessage, Throwable e, ExceptionReportCreator exceptionReportCreator) static voidsetErrorMessage(com.fasterxml.jackson.databind.JsonNode respData, String error) static com.fasterxml.jackson.databind.node.ArrayNodeMethods inherited from class com.vaadin.copilot.CopilotCommand
canBeParallelCommand, getProjectFileManager, getVaadinContext, getVaadinSession, handleConnect
-
Field Details
-
EXCEPTION_MESSAGE_KEY
- See Also:
-
EXCEPTION_STACKTRACE_KEY
- See Also:
-
-
Constructor Details
-
ErrorHandler
public ErrorHandler()
-
-
Method Details
-
toJson
-
setErrorMessage
-
setError
-
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 callssendErrorResponse(DevToolsInterface, String, JsonNode, String, Throwable, ExceptionReportCreator)withnullExceptionReportCreator object- Parameters:
devToolsInterface- to send error objectcommand- that has failedresponseData- Response data to fillerror- Error messagee- 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 viaDevToolsInterface. Message is constructed bysetError(JsonNode, String, Throwable, ExceptionReportCreator)- Parameters:
devToolsInterface- to send error objectcommand- that has failedresponseData- response data that is sent to clienterror- error messagee- exception to get stack traceexceptionReportCreator- 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:CopilotCommandCalled 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:
handleMessagein classCopilotCommand- Parameters:
command- the command to handledata- the data for the commanddevToolsInterface- the devtools interface for the connection- Returns:
- true if the command was handled, false otherwise
-