使用抛异常替代asset,提高代码稳定性

This commit is contained in:
xiongziliang
2020-05-30 11:49:36 +08:00
parent fb4435fca9
commit 31ad2caa6b
3 changed files with 39 additions and 0 deletions

View File

@@ -295,3 +295,10 @@ const string kBenchmarkMode = "benchmark_mode";
} // namespace mediakit
void Assert_Throw(int failed, const char *exp, const char *func, const char *file, int line){
if(failed) {
_StrPrinter printer;
printer << "Assertion failed: (" << exp << "), function " << func << ", file " << file << ", line " << line << ".";
throw std::runtime_error(printer);
}
}