| 582 | namespace { |
| 583 | |
| 584 | void check_async_error(cg::AsyncExecutable* func, int nr_error) { |
| 585 | try { |
| 586 | func->execute().wait(); |
| 587 | } catch (MegBrainError& exc) { |
| 588 | auto info = static_cast<const cg::OperatorNodeExcExtraInfo*>(exc.extra_info()); |
| 589 | auto msg_expect = ssprintf("%d async err", nr_error); |
| 590 | ASSERT_TRUE(!strncmp(exc.what(), msg_expect.c_str(), msg_expect.size())) |
| 591 | << "bad exception message: " << exc.what() << "\nnr_error=" << nr_error; |
| 592 | mgb_log("caught exception: %s opr=%s{%s}", exc.what(), info->opr()->cname(), |
| 593 | info->opr()->dyn_typeinfo()->name); |
| 594 | return; |
| 595 | } |
| 596 | ASSERT_TRUE(0) << "exception not thrown"; |
| 597 | } |
| 598 | |
| 599 | } // anonymous namespace |
| 600 | |