Skip to content

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

Closed
chenyahui wants to merge 2 commits into
gin-gonic:masterfrom
chenyahui:panic
Closed

chenyahui wants to merge 2 commits into
gin-gonic:masterfrom
chenyahui:panic

Conversation

@chenyahui

Copy link
Copy Markdown

In pr: #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.

@austinheap austinheap closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants