topfreegames / pitaya

Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.
MIT License
2.35k stars 482 forks source link

Can you provide a callback function for the error in request path 404? If there is a business interruption, please handle the path error information uniformly #371

Open liqingxi1116 opened 11 months ago

liqingxi1116 commented 11 months ago

pitaya/handler, url not found error

liqingxi1116 commented 11 months ago

Similar to gin's noRoute and noMethod, it allows me to customize error data structures

liqingxi1116 commented 11 months ago

for example , I don't want this {"code":"PIT-404","msg":"pitaya/handler: gateway.gateway.gadga not found"} data. I hope to customize the data structure

bruce1125 commented 11 months ago

what about checking the returned ERROR type?

felipejfc commented 10 months ago

Should be a simple change if you wish to send a contribution

pipiaha commented 1 month ago

422

provide your own ErrWrapper in builder.ErrWrapper, Marshal method encodes any error(including your error types) into bytes for net transfer;Unmarshal method converts any error typed bytes into origin errors.Error, to insure that errors.Error still works inside pitaya framework. Hope it helps.