Skip to content

Commit

Permalink
Add error code and error message
Browse files Browse the repository at this point in the history
Add error code and error message to synapse message context in the fault sequence.
  • Loading branch information
SavinduDimal committed Jun 18, 2024
1 parent c96d4f8 commit 6e38cc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ private void invokeFaultSequenceUponError(int statusCode, String reasonText) thr
MessageContext synCtx = getSynapseMessageContext(tenantDomain);
synCtx.setProperty(InboundWebsocketConstants.WEB_SOCKET_CLOSE_CODE, statusCode);
synCtx.setProperty(InboundWebsocketConstants.WEB_SOCKET_REASON_TEXT, reasonText);
synCtx.setProperty(WebsocketConstants.ERROR_CODE, statusCode);
synCtx.setProperty(WebsocketConstants.ERROR_MESSAGE, reasonText);
synCtx.setProperty(InboundWebsocketConstants.FAULT_SEQUENCE_INVOKED_ON_WEBSOCKET_CLIENT_HANDLER_ERROR, true);
getFaultSequence(synCtx, dispatchErrorSequence).mediate(synCtx);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ public class WebsocketConstants {
public static final String WS_CLOSE_DEFAULT_REASON_TEXT = "Websocket server terminated";

public static final int WEBSOCKET_UPSTREAM_ERROR_SC = 1014;
public static final String ERROR_CODE = "ERROR_CODE";
public static final String ERROR_MESSAGE = "ERROR_MESSAGE";
}

0 comments on commit 6e38cc1

Please sign in to comment.