Status codes [errors.status]

Avoid status codes.

type StatusCode = enum

func f(output: var Type): StatusCode


  • Interop with C


  • output undefined in case of error
  • Verbose to use, must first declare mutable variable then call function and check result - mutable variable remains in scope even in "error" branch leading to bugs

Practical notes

Unlike "Error Enums" used with Result, status codes mix "success" and "error" returns in a single enum, making it hard to detect "successful" completion of a function in a generic way.