Updated error messaging system

Error messages include error codes that can better track down problems
in the debugging phase.