shallow_errors and deep_errors are out params and should be passed by pointer