# Error Handling (UErrorCode)

Justification:

- No dependency on C++ exceptions
  -- Not all C++ compilers handle exceptions
  -- Exceptions not supported in C
- Allows multithreading

Usage:

- Caller allocates the error code
  -- on stack, local variable, input parameter
- Caller sets error code to ZERO_ERROR when allocated
- Pass error code by reference to each function
- Functions that can signal an error
  -- Check error code on entry
  -- Return immediately if not ZERO_ERROR
  -- Pass same error code through to called functions
- When error code is not ZERO_ERROR
  -- Attempt to cleanup allocated storage
  -- Return

code conventions