MCPcopy Create free account
hub / github.com/mmcgrana/gobyexample / Error

Method Error

examples/custom-errors/custom-errors.go:21–23  ·  view source on GitHub ↗

Adding this `Error` method makes `argError` implement the `error` interface.

()

Source from the content-addressed store, hash-verified

19// Adding this `Error` method makes `argError` implement
20// the `error` interface.
21func (e *argError) Error() string {
22 return fmt.Sprintf("%d - %s", e.arg, e.message)
23}
24
25func f(arg int) (int, error) {
26 if arg == 42 {

Callers 1

helloFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected