Go Language Error Handling

From NovaOrdis Knowledge Base
Revision as of 22:27, 30 August 2023 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

A common error generation pattern in Go is that function return an error instance as the second return value.

The returned error instance is implements the error interface:

type error interface {
  Error() string
}

Organizatorium

Create an error:

errors.New("at least three arguments are required")

TO DEPLETE

These are documents produced by the previous attempt. Process, merge into this document, and deplete: Go Concepts - Error Handling