MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / FromHTTPStatusCode

Function FromHTTPStatusCode

pkg/errors/http.go:78–89  ·  view source on GitHub ↗

FromHTTPStatusCode maps an HTTP response code to an error.

(status int, publicAttributes ...string)

Source from the content-addressed store, hash-verified

76
77// FromHTTPStatusCode maps an HTTP response code to an error.
78func FromHTTPStatusCode(status int, publicAttributes ...string) *Error {
79 code := uint32(codes.Unknown)
80 if c, ok := httpErrorCodes[status]; ok {
81 code = c
82 }
83 return build(&Definition{
84 namespace: namespace(2),
85 messageFormat: http.StatusText(status),
86 publicAttributes: publicAttributes,
87 code: code,
88 }, 4)
89}
90
91// ToHTTP writes the error to the HTTP response.
92func ToHTTP(in error, w http.ResponseWriter) error {

Callers 8

ClaimMethod · 0.92
UnclaimMethod · 0.92
GetClaimStatusMethod · 0.92
BatchUnclaimMethod · 0.92
TestRateLimitFunction · 0.92
httpExchangeFunction · 0.92
ProcessErrorFunction · 0.92
TestApplicationServerFunction · 0.92

Calls 2

buildFunction · 0.85
namespaceFunction · 0.85

Tested by 2

TestRateLimitFunction · 0.74
TestApplicationServerFunction · 0.74