Skip to content

Commit fb2bce2

Browse files
committed
refactor: remove un-needed code
1 parent 82bc595 commit fb2bce2

5 files changed

Lines changed: 4 additions & 184 deletions

File tree

internal/common/errors.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import (
66
"github.com/gofiber/fiber/v2"
77
)
88

9-
var (
10-
ErrAuthentication = errors.New("token authentication failed")
11-
ErrInvalidDateTime = errors.New("invalid date time format (RFC 3339 needed)")
12-
ErrKeyLen = errors.New("PASETO_KEY must be 32 bytes long once base64-decoded")
13-
)
14-
159
func InternalServerError(title string) ProblemJSONError {
1610
return Error(fiber.StatusInternalServerError, title, fiber.ErrInternalServerError.Message)
1711
}
@@ -20,14 +14,6 @@ func Error(status int, title string, detail string) ProblemJSONError {
2014
return ProblemJSONError{Title: title, Detail: detail, Status: status}
2115
}
2216

23-
func ErrorWithValidationErrors(
24-
status int, title string, validationErrors []ValidationError,
25-
) ProblemJSONError {
26-
detail := GenerateErrorDetails(validationErrors)
27-
28-
return ProblemJSONError{Title: title, Detail: detail, Status: status, ValidationErrors: validationErrors}
29-
}
30-
3117
func CustomErrorHandler(ctx *fiber.Ctx, err error) error {
3218
var problemJSON *ProblemJSONError
3319

@@ -37,10 +23,6 @@ func CustomErrorHandler(ctx *fiber.Ctx, err error) error {
3723
problemJSON = &ProblemJSONError{Status: e.Code, Title: e.Message}
3824
}
3925

40-
if errors.Is(err, ErrAuthentication) {
41-
problemJSON = &ProblemJSONError{Status: fiber.StatusUnauthorized, Title: err.Error()}
42-
}
43-
4426
if problemJSON == nil {
4527
//nolint:errorlint
4628
switch e := err.(type) {

internal/common/problem_json.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
)
66

77
type ProblemJSONError struct {
8-
Code string `json:"code,omitempty"`
9-
Title string `json:"title"`
10-
Detail string `json:"detail,omitempty"`
11-
Status int `json:"status"`
12-
ValidationErrors []ValidationError `json:"validationErrors,omitempty"`
8+
Code string `json:"code,omitempty"`
9+
Title string `json:"title"`
10+
Detail string `json:"detail,omitempty"`
11+
Status int `json:"status"`
1312
}
1413

1514
func (pj ProblemJSONError) Error() string {

internal/common/requests.go

Lines changed: 0 additions & 47 deletions
This file was deleted.

internal/common/responses.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

internal/common/validator.go

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)