Skip to content

En/error fields #1615

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

Open
wants to merge 33 commits into
base: development
Choose a base branch
from
Open

En/error fields #1615

wants to merge 33 commits into from

Conversation

Umang01-hash
Copy link
Member

@Umang01-hash Umang01-hash commented Mar 27, 2025

Pull Request Template

Description:

  • Allows users to add more fields in their error response.

Example

Screenshot 2025-03-27 at 10 14 21 AM

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

Thank you for your contribution!

@coolwednesday
Copy link
Contributor

@Umang01-hash , when we send an empty struct, ideally we should get a 500 status code and some details(that are hardcoded and do not need to be initialised) in the error response . However in such case it returns a 200 status code ...a new field status as 500 and status as Error. Seems a bit weird.

Screenshot 2025-03-27 at 3 16 19 PM

Also whenever the status code is not set, can we handle to return 500 ? As in current case it causes panic in writeHeader.

@Umang01-hash Umang01-hash requested a review from ccoVeille April 10, 2025 11:28
@Umang01-hash Umang01-hash requested a review from ccoVeille April 14, 2025 03:33
@aryanmehrotra aryanmehrotra requested a review from Copilot April 14, 2025 10:03
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

docs/advanced-guide/gofr-errors/page.md:73

  • There is a naming inconsistency between 'ResponseMarshaler' defined in the docs and 'ResponseMarshaller' used in the code. Consider aligning the interface naming for clarity.
type ResponseMarshaler interface {

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.

4 participants