gin icon indicating copy to clipboard operation
gin copied to clipboard

Only push net error to c.Errors and panic others errors

Open chenyahui opened this issue 1 year ago • 0 comments

In pr: https://github.com/gin-gonic/gin/pull/2150, remove the panic in Render function and push all error to c.Errors.

This is to avoid panic when encountering "broken pipe -> write tcp" errors, in order to improve program performance.

However, this will also cause the program to ignore errors from json.Marshal(). When an error occurs during json.Marshal(), the client will only receive an empty http body.

Therefore, when it is a non-network error, Render() still needs to panic in order for the client to be aware of this error.

chenyahui avatar Apr 28 '23 08:04 chenyahui