Skip to content

Commit

Permalink
catch parser errors in python when using parseRangeList
Browse files Browse the repository at this point in the history
  • Loading branch information
agrossfield committed Aug 8, 2020
1 parent e79dbff commit cd2af06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/catch_it.i
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ createTrajectory;
std::logic_error)\
selectAtoms;

%catches(loos::ParseError) parseRangeList;

// amber
%catches(loos::FileOpenError, loos::FileReadErrorWithLine, loos::LOOSError) Amber::Amber;
Expand Down
6 changes: 5 additions & 1 deletion src/exceptions.i
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%{


#include <sstream>
#include <exception>
Expand Down Expand Up @@ -39,7 +39,11 @@
const char* __str__() { std::string s = self->what(); return(s.c_str()); }
}


%extend loos::FileWriteError {
const char* __str__() { std::string s = self->what(); return(s.c_str()); }
}

%extend loos::ParseError {
const char* __str__() { std::string s = self->what(); return(s.c_str()); }
}

0 comments on commit cd2af06

Please sign in to comment.