Skip to content

Commit 2eea1b0

Browse files
committed
debugger catches exceptions in debug mode
#refactor
1 parent 09125c3 commit 2eea1b0

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/tool/ToolMain.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ mrdocs_main(int argc, char const** argv)
153153
return EXIT_SUCCESS;
154154
}
155155

156+
#ifdef _NDEBUG
156157
static
157158
void
158159
reportUnhandledException(
@@ -163,24 +164,29 @@ reportUnhandledException(
163164
report::fatal("Unhandled exception: {}\n", ex.what());
164165
sys::PrintStackTrace(llvm::errs());
165166
}
167+
#endif
166168

167169
} // clang::mrdocs
168170

169171
int
170172
main(int argc, char const** argv)
171173
{
172-
// try
173-
// {
174+
#ifndef _NDEBUG
175+
return clang::mrdocs::mrdocs_main(argc, argv);
176+
#else
177+
try
178+
{
174179
return clang::mrdocs::mrdocs_main(argc, argv);
175-
// }
176-
// catch(clang::mrdocs::Exception const& ex)
177-
// {
180+
}
181+
catch(clang::mrdocs::Exception const& ex)
182+
{
178183
// Thrown Exception should never get here.
179-
// clang::mrdocs::reportUnhandledException(ex);
180-
// }
181-
// catch(std::exception const& ex)
182-
// {
183-
// clang::mrdocs::reportUnhandledException(ex);
184-
// }
185-
// return EXIT_FAILURE;
184+
clang::mrdocs::reportUnhandledException(ex);
185+
}
186+
catch(std::exception const& ex)
187+
{
188+
clang::mrdocs::reportUnhandledException(ex);
189+
}
190+
return EXIT_FAILURE;
191+
#endif
186192
}

0 commit comments

Comments
 (0)