MCPcopy
hub / github.com/caddyserver/caddy / parseErrorCode

Function parseErrorCode

modules/caddyhttp/fileserver/matcher.go:533–542  ·  view source on GitHub ↗

parseErrorCode checks if the input is a status code number, prefixed by "=", and returns an error if so.

(input string)

Source from the content-addressed store, hash-verified

531// code number, prefixed by "=", and returns an
532// error if so.
533func parseErrorCode(input string) error {
534 if len(input) > 1 && input[0] == '=' {
535 code, err := strconv.Atoi(input[1:])
536 if err != nil || code < 100 || code > 999 {
537 return nil
538 }
539 return caddyhttp.Error(code, fmt.Errorf("%s", input[1:]))
540 }
541 return nil
542}
543
544// strictFileExists returns true if file exists
545// and matches the convention of the given file

Callers 1

selectFileMethod · 0.85

Calls 1

ErrorFunction · 0.92

Tested by

no test coverage detected