Back to Languages/go

Go has a built-in error type.

error type

type error interface {
    Error() string

error is an interface type. An error var represents any value that can describe itself as a string.

// errorString is a trivial implementation of error.
type errorString struct {
    s string

func (e *errorString) Error() string {
    return e.s