parseErrorCode checks if the input is a status code number, prefixed by "=", and returns an error if so.
(input string)
| 531 | // code number, prefixed by "=", and returns an |
| 532 | // error if so. |
| 533 | func 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 |