Add and use libclang_error exception class
This commit is contained in:
parent
51f7c3c2b2
commit
a0c2eece5b
3 changed files with 32 additions and 2 deletions
|
|
@ -134,7 +134,23 @@ namespace
|
|||
| CXTranslationUnit_KeepGoing, // flags
|
||||
&tu);
|
||||
if (error != CXError_Success)
|
||||
DEBUG_UNREACHABLE(detail::assert_handler{}, "libclang error"); // TODO
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case CXError_Success:
|
||||
DEBUG_UNREACHABLE(detail::assert_handler{});
|
||||
break;
|
||||
|
||||
case CXError_Failure:
|
||||
throw libclang_error("clang_parseTranslationUnit: generic error");
|
||||
case CXError_Crashed:
|
||||
throw libclang_error("clang_parseTranslationUnit: libclang crashed :(");
|
||||
case CXError_InvalidArguments:
|
||||
throw libclang_error("clang_parseTranslationUnit: you shouldn't see this message");
|
||||
case CXError_ASTReadError:
|
||||
throw libclang_error("clang_parseTranslationUnit: AST deserialization error");
|
||||
}
|
||||
}
|
||||
|
||||
return tu;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ namespace
|
|||
|
||||
auto exit_code = process.get_exit_status();
|
||||
if (exit_code != 0)
|
||||
DEBUG_UNREACHABLE(detail::assert_handler{}); // TODO: improve error handling
|
||||
throw libclang_error("preprocessor: command '" + cmd
|
||||
+ "' exited with non-zero exit code (" + std::to_string(exit_code)
|
||||
+ ")");
|
||||
|
||||
return preprocessed;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue