|
9 | 9 |
|
10 | 10 | "github.com/clubpay/ronykit" |
11 | 11 | "github.com/clubpay/ronykit/internal/common" |
| 12 | + "github.com/clubpay/ronykit/internal/errors" |
12 | 13 | "github.com/clubpay/ronykit/internal/httpmux" |
13 | 14 | "github.com/clubpay/ronykit/utils" |
14 | 15 | "github.com/clubpay/ronykit/utils/buf" |
@@ -213,13 +214,13 @@ func (b *bundle) wsDispatch(ctx *ronykit.Context, in []byte) (ronykit.ExecuteArg |
213 | 214 |
|
214 | 215 | routeData := b.wsRoutes[inputMsgContainer.GetHdr(b.predicateKey)] |
215 | 216 | if routeData == nil { |
216 | | - return ronykit.NoExecuteArg, errNoHandler |
| 217 | + return ronykit.NoExecuteArg, ronykit.ErrNoHandler |
217 | 218 | } |
218 | 219 |
|
219 | 220 | msg := routeData.Factory() |
220 | 221 | err = inputMsgContainer.Fill(msg) |
221 | 222 | if err != nil { |
222 | | - return ronykit.NoExecuteArg, err |
| 223 | + return ronykit.NoExecuteArg, errors.Wrap(ronykit.ErrDecodeIncomingMessageFailed, err) |
223 | 224 | } |
224 | 225 |
|
225 | 226 | ctx.In(). |
@@ -278,7 +279,7 @@ func (b *bundle) httpDispatch(ctx *ronykit.Context, in []byte) (ronykit.ExecuteA |
278 | 279 | b.cors.handle(conn, routeData != nil) |
279 | 280 |
|
280 | 281 | if routeData == nil { |
281 | | - return ronykit.NoExecuteArg, errRouteNotFound |
| 282 | + return ronykit.NoExecuteArg, ronykit.ErrNoHandler |
282 | 283 | } |
283 | 284 |
|
284 | 285 | // Walk over all the query params |
@@ -307,7 +308,7 @@ func (b *bundle) httpDispatch(ctx *ronykit.Context, in []byte) (ronykit.ExecuteA |
307 | 308 |
|
308 | 309 | m, err := routeData.Decoder(params, in) |
309 | 310 | if err != nil { |
310 | | - return ronykit.NoExecuteArg, err |
| 311 | + return ronykit.NoExecuteArg, errors.Wrap(ronykit.ErrDecodeIncomingMessageFailed, err) |
311 | 312 | } |
312 | 313 |
|
313 | 314 | ctx.In(). |
@@ -375,9 +376,3 @@ func (b *bundle) Shutdown(_ context.Context) error { |
375 | 376 | func (b *bundle) Subscribe(d ronykit.GatewayDelegate) { |
376 | 377 | b.d = d |
377 | 378 | } |
378 | | - |
379 | | -var ( |
380 | | - errRouteNotFound = fmt.Errorf("route not found") |
381 | | - errNoHandler = fmt.Errorf("no handler for request") |
382 | | - errConnectionClosed = fmt.Errorf("connection closed") |
383 | | -) |
0 commit comments