vertx-web
                                
                                 vertx-web copied to clipboard
                                
                                    vertx-web copied to clipboard
                            
                            
                            
                        Hook consumer for error reply in SockJS handler
Version
- vert.x core: 3.6.0
- vert.x web: 3.6.0
Context
When encountered error in a websocket call via sockjs, I would like unify reply message of vertx with my system.
For example:
{"type":"err","body":"invalid_json"} => {"status":"FAILED","error":{"code":"INVALID_ARGUMENT","message":"Message format is not correct"}}
I think vertx can change a little bit SockJSHandlerImpl:
- Change it from private statictoprotectedhttps://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/java/io/vertx/ext/web/handler/sockjs/impl/EventBusBridgeImpl.java#L551-L554
- Provide one more replyErrorprotected method to handle json message https://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/java/io/vertx/ext/web/handler/sockjs/impl/EventBusBridgeImpl.java#L457-L463
Btw, should we use BridgeEventType instead of plain String in here (reason: case sensitive)
https://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/java/io/vertx/ext/web/handler/sockjs/impl/EventBusBridgeImpl.java#L136-L150
Sounds interesting. Are you willing to contribute?
More than making replyError protected, it should add to error object the error string as "message" key, more than "body" key
sorry, I'm using IE :stuck_out_tongue_closed_eyes: 2 years then almost forget this ticket
This issue is still here. It might related to https://github.com/vert-x3/vertx-web/issues/2001