aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Archive/ArchiveReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Archive/ArchiveReader.cpp')
-rw-r--r--lib/Archive/ArchiveReader.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index b00487f..a813371 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -280,13 +280,17 @@ Archive::loadArchive() {
// Open and completely load the archive file.
Archive*
-Archive::OpenAndLoad(const sys::Path& file) {
-
- Archive* result = new Archive(file, true);
-
- result->loadArchive();
-
- return result;
+Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) {
+ try {
+ Archive* result = new Archive(file, true);
+ result->loadArchive();
+ return result;
+ } catch (const std::string& msg) {
+ if (ErrorMessage) {
+ *ErrorMessage = msg;
+ }
+ return 0;
+ }
}
// Get all the bytecode modules from the archive
@@ -371,12 +375,17 @@ Archive::loadSymbolTable() {
// Open the archive and load just the symbol tables
Archive*
-Archive::OpenAndLoadSymbols(const sys::Path& file) {
- Archive* result = new Archive(file, true);
-
- result->loadSymbolTable();
-
- return result;
+Archive::OpenAndLoadSymbols(const sys::Path& file, std::string* ErrorMessage) {
+ try {
+ Archive* result = new Archive(file, true);
+ result->loadSymbolTable();
+ return result;
+ } catch (const std::string& msg) {
+ if (ErrorMessage) {
+ *ErrorMessage = msg;
+ }
+ return 0;
+ }
}
// Look up one symbol in the symbol table and return a ModuleProvider for the