Skip to content
Permalink
Browse files

add NotHandle 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 2e76094aa70eecf50fcd2e4df33e861246a8a3e6
Showing with 5 additions and 0 deletions.
  1. +5 −0 error.go
@@ -1,10 +1,15 @@
package httperror

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

// NotHandle is returned by a maybe HTTP handler to report
// that it explicitly chose to not handle the given HTTP request.
var NotHandle = 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 2e76094

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