File: errors.go

package info (click to toggle)
golang-github-fasthttp-router 1.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 284 kB
  • sloc: makefile: 3
file content (27 lines) | stat: -rw-r--r-- 832 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package radix

import (
	"fmt"
)

const (
	errSetHandler         = "a handler is already registered for path '%s'"
	errSetWildcardHandler = "a wildcard handler is already registered for path '%s'"
	errWildPathConflict   = "'%s' in new path '%s' conflicts with existing wild path '%s' in existing prefix '%s'"
	errWildcardConflict   = "'%s' in new path '%s' conflicts with existing wildcard '%s' in existing prefix '%s'"
	errWildcardSlash      = "no / before wildcard in path '%s'"
	errWildcardNotAtEnd   = "wildcard routes are only allowed at the end of the path in path '%s'"
)

type radixError struct {
	msg    string
	params []interface{}
}

func (err radixError) Error() string {
	return fmt.Sprintf(err.msg, err.params...)
}

func newRadixError(msg string, params ...interface{}) radixError {
	return radixError{msg, params}
}