Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannm committed Jan 12, 2022
1 parent c8fdb5a commit 3469a5f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
26 changes: 20 additions & 6 deletions edge/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,16 @@ func (edge *Server) onGatewayRest(ctx *DispatchCtx, conn rony.RestConn, proxy Re
// apply the transformation on the client message before execute it
err := proxy.ClientMessage(conn, ctx)
if err != nil {
conn.WriteStatus(http.StatusInternalServerError)
b, _ := errors.New(errors.Internal, err.Error()).MarshalJSON()
_ = conn.WriteBinary(0, b)
switch err := err.(type) {
case *rony.Error:
conn.WriteStatus(errors.Code(err.Code).HttpStatus())
b, _ := err.MarshalJSON()
_ = conn.WriteBinary(0, b)
default:
conn.WriteStatus(http.StatusInternalServerError)
b, _ := errors.New(errors.Internal, err.Error()).MarshalJSON()
_ = conn.WriteBinary(0, b)
}

return
}
Expand All @@ -389,9 +396,16 @@ func (edge *Server) onGatewayRest(ctx *DispatchCtx, conn rony.RestConn, proxy Re
// apply the transformation on the server message before sending it to the client
err = proxy.ServerMessage(conn, ctx)
if err != nil {
conn.WriteStatus(http.StatusInternalServerError)
b, _ := errors.New(errors.Internal, err.Error()).MarshalJSON()
_ = conn.WriteBinary(0, b)
switch err := err.(type) {
case *rony.Error:
conn.WriteStatus(errors.Code(err.Code).HttpStatus())
b, _ := err.MarshalJSON()
_ = conn.WriteBinary(0, b)
default:
conn.WriteStatus(http.StatusInternalServerError)
b, _ := errors.New(errors.Internal, err.Error()).MarshalJSON()
_ = conn.WriteBinary(0, b)
}
}
}
func (edge *Server) onGatewayConnect(conn rony.Conn, kvs ...*rony.KeyValue) {
Expand Down
4 changes: 2 additions & 2 deletions internal/codegen/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package codegen
// This is auto-generated code; DO NOT EDIT.

var (
Commit = "e5a02a53fb1a9ab591c16d5e6882c951193a5fbd"
Version = "v0.16.22"
Commit = "c8fdb5a6cfc8fc92f1693aed188936a934cebe37"
Version = "v0.16.23"
)

0 comments on commit 3469a5f

Please # to comment.