Skip to content

Comments

fix: added http error codes#146

Open
NeelMalwatkar wants to merge 1 commit intotink3rlabs:mainfrom
NeelMalwatkar:main
Open

fix: added http error codes#146
NeelMalwatkar wants to merge 1 commit intotink3rlabs:mainfrom
NeelMalwatkar:main

Conversation

@NeelMalwatkar
Copy link

@NeelMalwatkar NeelMalwatkar commented Feb 19, 2026

Issue : #144

  • Added MethodNotAllowed (405)
  • Added Conflict (409)
  • Added Gone (410)
  • Added UnsupportedMediaType (415)
  • Added UnprocessableEntity (422)
  • Added TooManyRequests (429)
  • Added InternalServerError (500)
  • Added NotImplemented (501)
  • Added BadGateway (502)
  • Added GatewayTimeout (504)
  • Added RequestTimeout (408)

return e.Message
}

type MethodNotAllowed struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @NeelMalwatkar ,
This is a prime candidate for Composition (part of how the Go programing language is designed)

// 1. Define the base structure
type BaseError struct {
    Message string
}

func (e *BaseError) Error() string {
    return e.Message
}

// 2. Compose specific errors using the base
type MethodNotAllowed struct{ BaseError }
type Conflict struct{ BaseError }
type Gone struct{ BaseError }
type UnsupportedMediaType struct{ BaseError }
// ... and so on

@ayashjorden
Copy link
Contributor

While I don't want to scope-creep this PR, error_handler.go may benefit from some generalization or refactoring to make it DRY.
If this becomes tangled, I'm ok with improving in a separate PR

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