Classes shouldn't really be using trigger_error. They should return the error so that the controller can output the error (easiest way is probably to throw an exception).