Assign error code to object on instantiation