Skip to content

Commit 7d11078

Browse files
committed
Just propagate any errors through
1 parent 92e48c0 commit 7d11078

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

leetcode/parser.hpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -276,19 +276,15 @@ void run(R (Solution::*fn)(Ts...)) {
276276
return;
277277
}
278278

279-
try {
280-
if constexpr (same_as<R, void>) {
281-
apply(fn, args);
282-
[]<size_t... Idx>(auto &&args, index_sequence<Idx...>) {
283-
((cout << "#" << (Idx + 1) << ": ",
284-
print_impl(cout, get<Idx + 1>(args), true)),
285-
...);
286-
}(args, index_sequence_for<Ts...>{});
287-
} else {
288-
auto res = apply(fn, args);
289-
print_impl(cout, res, true);
290-
}
291-
} catch (const exception &e) {
292-
cerr << "Runtime error: " << e.what() << endl;
279+
if constexpr (same_as<R, void>) {
280+
apply(fn, args);
281+
[]<size_t... Idx>(auto &&args, index_sequence<Idx...>) {
282+
((cout << "#" << (Idx + 1) << ": ",
283+
print_impl(cout, get<Idx + 1>(args), true)),
284+
...);
285+
}(args, index_sequence_for<Ts...>{});
286+
} else {
287+
auto res = apply(fn, args);
288+
print_impl(cout, res, true);
293289
}
294290
}

0 commit comments

Comments
 (0)