Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't panic when failed to render or write JSON #3390

Closed

Conversation

git-hulk
Copy link

@git-hulk git-hulk commented Nov 7, 2022

Currently, gin will panic if failed to write JSON to client and it's unnecessary for most scenarios. Because most of them are caused by network error like connection reset or timeout, it'd be better to retrieve an error instead of panic.

This PR can also fix this issue: #3351

Currently, gin will panic if failed to write JSON to client and it's
unnecessary for most scenarios. Because most of them are caused by
network error like connection reset or timeout, it'd be better to
retrieve an error instead of panic.
Copy link

@danmux danmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whilst this does not change the API signature it does change the behaviour, which may be considered a breaking change, but these are rare and clients of this call should be handling errors.

This also makes the API more consistent with other renderers

Copy link

@danmux danmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thinkerou
Copy link
Member

duplicate #2150

@thinkerou thinkerou closed this Jan 17, 2023
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.

None yet

3 participants