-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
27 lines (21 loc) · 758 Bytes
/
errors.go
File metadata and controls
27 lines (21 loc) · 758 Bytes
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 errors
import "errors"
// Const an error that can be used as a constant.
//
// The error message should be in the form of
// `package: func: error message`
// `package: error message`
//
// Eg: `encoding/json: Marshal: unsupported type`
type Const string
// Error an error that can be used as a constant
//
// Deprecated: use errors.Const for constants and [New] for other uses.
type Error = Const
var _ error = Const("test")
func (c Const) Error() string { return *(*string)(&c) }
// New returns an error that formats as the given text.
// Each call to New returns a distinct error value even if the text is identical.
//
// This function is an alias to [errors.New] in the standard library.
func New(e string) error { return errors.New(e) }