Skip to content
Permalink
Browse files

add ErrNotHandle sentinel error value

A maybe HTTP handlers is an HTTP handler that may or may not handle
a request, depending on whether it matches the necessary criteria.

This new sentinel error value will be used to by such maybe HTTP
handlers to report that the request was explicitly not handled.

Any other error, such as the nil error or another non-nil error,
implies the maybe HTTP handler has handled the given request.
  • Loading branch information...
dmitshur committed May 6, 2019
1 parent 53f8c53 commit cc25caffc04507d00200aee2e521df0b3bf14a7e
Showing with 5 additions and 0 deletions.
  1. +5 −0 error.go
@@ -1,10 +1,15 @@
package httperror

import (
"errors"
"fmt"
"strings"
)

// ErrNotHandle is returned by a maybe HTTP handler to report
// that it explicitly chose to not handle the given HTTP request.
var ErrNotHandle = errors.New("httperror: maybe HTTP handler chose to not handle request")

// Method is an error type used for methods that aren't allowed.
type Method struct {
Allowed []string // Allowed methods.

0 comments on commit cc25caf

Please sign in to comment.
You can’t perform that action at this time.