Skip to content

Commit 225e654

Browse files
committed
feat: added NewJSendDebugNotImplemented and NewJSendDebugNotImplemented functions
1 parent 2b4ffa3 commit 225e654

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

http/status/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var (
99
InternalServerError = http.StatusText(http.StatusInternalServerError)
1010
ServiceUnavailable = http.StatusText(http.StatusServiceUnavailable)
1111
Unauthorized = http.StatusText(http.StatusUnauthorized)
12+
NotImplemented = http.StatusText(http.StatusNotImplemented)
1213
)
1314

1415
const (

http/status/errors/errors.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package errors
22

33
import (
44
"errors"
5-
gonethttp "github.com/ralvarezdev/go-net/http/status"
5+
gonethttpstatus "github.com/ralvarezdev/go-net/http/status"
66
)
77

88
var (
9-
BadRequest = errors.New(gonethttp.BadRequest)
10-
InternalServerError = errors.New(gonethttp.InternalServerError)
11-
ServiceUnavailable = errors.New(gonethttp.ServiceUnavailable)
12-
Unauthorized = errors.New(gonethttp.Unauthorized)
9+
BadRequest = errors.New(gonethttpstatus.BadRequest)
10+
InternalServerError = errors.New(gonethttpstatus.InternalServerError)
11+
ServiceUnavailable = errors.New(gonethttpstatus.ServiceUnavailable)
12+
Unauthorized = errors.New(gonethttpstatus.Unauthorized)
13+
NotImplemented = errors.New(gonethttpstatus.NotImplemented)
1314
Unauthenticated = errors.New("missing or invalid bearer token on authentication header")
1415
)

http/status/response/errors.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,30 @@ func NewJSendInternalServerError(
3232
http.StatusInternalServerError,
3333
)
3434
}
35+
36+
// NewJSendDebugNotImplemented creates a new not implemented JSend response with debug information
37+
func NewJSendDebugNotImplemented(
38+
debugErr error,
39+
errorCode *string,
40+
) gonethttpresponse.Response {
41+
return gonethttpresponse.NewJSendErrorResponse(
42+
gonethttpstatuserrors.NotImplemented,
43+
debugErr,
44+
nil,
45+
errorCode,
46+
http.StatusNotImplemented,
47+
)
48+
}
49+
50+
// NewJSendNotImplemented creates a new not implemented JSend response
51+
func NewJSendNotImplemented(
52+
errorCode *string,
53+
) gonethttpresponse.Response {
54+
return gonethttpresponse.NewJSendErrorResponse(
55+
gonethttpstatuserrors.NotImplemented,
56+
nil,
57+
nil,
58+
errorCode,
59+
http.StatusNotImplemented,
60+
)
61+
}

0 commit comments

Comments
 (0)