Go errors and exceptions
Handle invalid entries, missing records, and interrupted work. Follow each failure from the input that triggers it to a response the user can act on.
Input and validation
- Comma-ok type assertionCheck the type of an imported fare
- nil pointer checkPrint a label when the phone number is missing
- regexp.Compile errorValidate a saved product search
- strconv.Atoi errorReject a mistyped order quantity
- time.Parse errorCheck a delivery date entered on a form
State and collections
- Integer divisor checkSplit an equipment fee across a class
- Slice bounds checkFind a seat after the coach changes
Files and streams
- errors.Is and fs.ErrNotExistRecover when a receipt is missing
- io.ErrUnexpectedEOFRead a stock count from a short record
Jobs and runtime
- context.CanceledCollect a cancelled print job
- context.DeadlineExceededLimit the wait for a shipping quote