TST: Add tests for build_err_msg