woj-server/internal/e/err.go

25 lines
340 B
Go

package e
import (
"errors"
"net/url"
)
type Status int
func (code Status) String() string {
msg, ok := msgText[code]
if ok {
return msg
}
return msgText[InternalError]
}
func (code Status) QueryString() string {
return url.QueryEscape(code.String())
}
func (code Status) AsError() error {
return errors.New(code.String())
}