Changing parameter order in exception classes + improvements
authorPeter Kovacs <kpeter@inf.elte.hu>
Wed, 01 Oct 2008 11:58:03 +0200
changeset 291d901321d6555
parent 290 f6899946c1ac
child 292 e7af73f1805e
Changing parameter order in exception classes + improvements
lemon/error.h
lemon/graph_to_eps.h
lemon/lgf_reader.h
lemon/lgf_writer.h
     1.1 --- a/lemon/error.h	Tue Sep 30 20:53:18 2008 +0200
     1.2 +++ b/lemon/error.h	Wed Oct 01 11:58:03 2008 +0200
     1.3 @@ -41,11 +41,11 @@
     1.4    ///
     1.5    class Exception : public std::exception {
     1.6    public:
     1.7 -    ///\e Constructor
     1.8 -    Exception() {}
     1.9 -    ///\e Virtual destructor
    1.10 +    ///Constructor
    1.11 +    Exception() throw() {}
    1.12 +    ///Virtual destructor
    1.13      virtual ~Exception() throw() {}
    1.14 -    ///\e A short description of the exception
    1.15 +    ///A short description of the exception
    1.16      virtual const char* what() const throw() {
    1.17        return "lemon::Exception";
    1.18      }
    1.19 @@ -64,29 +64,31 @@
    1.20    public:
    1.21  
    1.22      /// Copy constructor
    1.23 -    IoError(const IoError &error) {
    1.24 +    IoError(const IoError &error) throw() : Exception() {
    1.25        message(error._message);
    1.26        file(error._file);
    1.27      }
    1.28  
    1.29      /// Constructor
    1.30 -    explicit IoError(const char *message) {
    1.31 +    explicit IoError(const char *message) throw() {
    1.32        IoError::message(message);
    1.33      }
    1.34  
    1.35      /// Constructor
    1.36 -    explicit IoError(const std::string &message) {
    1.37 +    explicit IoError(const std::string &message) throw() {
    1.38        IoError::message(message);
    1.39      }
    1.40  
    1.41      /// Constructor
    1.42 -    IoError(const std::string &file, const char *message) {
    1.43 +    explicit IoError(const char *message,
    1.44 +                     const std::string &file) throw() {
    1.45        IoError::message(message);
    1.46        IoError::file(file);
    1.47      }
    1.48  
    1.49      /// Constructor
    1.50 -    IoError(const std::string &file, const std::string &message) {
    1.51 +    explicit IoError(const std::string &message,
    1.52 +                     const std::string &file) throw() {
    1.53        IoError::message(message);
    1.54        IoError::file(file);
    1.55      }
    1.56 @@ -95,53 +97,50 @@
    1.57      virtual ~IoError() throw() {}
    1.58  
    1.59      /// Set the error message
    1.60 -    void message(const char *message) {
    1.61 +    void message(const char *message) throw() {
    1.62        try {
    1.63          _message = message;
    1.64        } catch (...) {}
    1.65      }
    1.66  
    1.67      /// Set the error message
    1.68 -    void message(const std::string& message) {
    1.69 +    void message(const std::string& message) throw() {
    1.70        try {
    1.71          _message = message;
    1.72        } catch (...) {}
    1.73      }
    1.74  
    1.75      /// Set the file name
    1.76 -    void file(const std::string &file) {
    1.77 +    void file(const std::string &file) throw() {
    1.78        try {
    1.79          _file = file;
    1.80        } catch (...) {}
    1.81      }
    1.82  
    1.83      /// Returns the error message
    1.84 -    const std::string& message() const {
    1.85 +    const std::string& message() const throw() {
    1.86        return _message;
    1.87      }
    1.88  
    1.89      /// \brief Returns the filename
    1.90      ///
    1.91 -    /// Returns the filename or empty string if the filename was not
    1.92 -    /// specified.
    1.93 -    const std::string& file() const {
    1.94 +    /// Returns the filename or an empty string if it was not specified.
    1.95 +    const std::string& file() const throw() {
    1.96        return _file;
    1.97      }
    1.98  
    1.99      /// \brief Returns a short error message
   1.100      ///
   1.101 -    /// Returns a short error message which contains the message, the
   1.102 -    /// file name and the line number.
   1.103 +    /// Returns a short error message which contains the message and the
   1.104 +    /// file name.
   1.105      virtual const char* what() const throw() {
   1.106        try {
   1.107          _what.clear();
   1.108          std::ostringstream oss;
   1.109          oss << "lemon:IoError" << ": ";
   1.110 -        oss << message();
   1.111 -        if (!file().empty()) {
   1.112 -          oss << " (";
   1.113 -          if (!file().empty()) oss << "with file '" << file() << "'";
   1.114 -          oss << ")";
   1.115 +        oss << _message;
   1.116 +        if (!_file.empty()) {
   1.117 +          oss << " ('" << _file << "')";
   1.118          }
   1.119          _what = oss.str();
   1.120        }
   1.121 @@ -154,8 +153,8 @@
   1.122  
   1.123    /// \brief Format error
   1.124    ///
   1.125 -  /// This class is used to indicate if an input file has wrong
   1.126 -  /// formatting, or a data representation is not legal.
   1.127 +  /// This exception is thrown when an input file has wrong
   1.128 +  /// format or a data representation is not legal.
   1.129    class FormatError : public Exception {
   1.130    protected:
   1.131      std::string _message;
   1.132 @@ -166,33 +165,35 @@
   1.133    public:
   1.134  
   1.135      /// Copy constructor
   1.136 -    FormatError(const FormatError &error) {
   1.137 +    FormatError(const FormatError &error) throw() : Exception() {
   1.138        message(error._message);
   1.139        file(error._file);
   1.140        line(error._line);
   1.141      }
   1.142  
   1.143      /// Constructor
   1.144 -    explicit FormatError(const char *message) {
   1.145 +    explicit FormatError(const char *message) throw() {
   1.146        FormatError::message(message);
   1.147        _line = 0;
   1.148      }
   1.149  
   1.150      /// Constructor
   1.151 -    explicit FormatError(const std::string &message) {
   1.152 +    explicit FormatError(const std::string &message) throw() {
   1.153        FormatError::message(message);
   1.154        _line = 0;
   1.155      }
   1.156  
   1.157      /// Constructor
   1.158 -    FormatError(const std::string &file, int line, const char *message) {
   1.159 +    explicit FormatError(const char *message,
   1.160 +                         const std::string &file, int line = 0) throw() {
   1.161        FormatError::message(message);
   1.162        FormatError::file(file);
   1.163        FormatError::line(line);
   1.164      }
   1.165  
   1.166      /// Constructor
   1.167 -    FormatError(const std::string &file, int line, const std::string &message) {
   1.168 +    explicit FormatError(const std::string &message,
   1.169 +                         const std::string &file, int line = 0) throw() {
   1.170        FormatError::message(message);
   1.171        FormatError::file(file);
   1.172        FormatError::line(line);
   1.173 @@ -202,24 +203,24 @@
   1.174      virtual ~FormatError() throw() {}
   1.175  
   1.176      /// Set the line number
   1.177 -    void line(int line) { _line = line; }
   1.178 +    void line(int line) throw() { _line = line; }
   1.179  
   1.180      /// Set the error message
   1.181 -    void message(const char *message) {
   1.182 +    void message(const char *message) throw() {
   1.183        try {
   1.184          _message = message;
   1.185        } catch (...) {}
   1.186      }
   1.187  
   1.188      /// Set the error message
   1.189 -    void message(const std::string& message) {
   1.190 +    void message(const std::string& message) throw() {
   1.191        try {
   1.192          _message = message;
   1.193        } catch (...) {}
   1.194      }
   1.195  
   1.196      /// Set the file name
   1.197 -    void file(const std::string &file) {
   1.198 +    void file(const std::string &file) throw() {
   1.199        try {
   1.200          _file = file;
   1.201        } catch (...) {}
   1.202 @@ -228,18 +229,17 @@
   1.203      /// \brief Returns the line number
   1.204      ///
   1.205      /// Returns the line number or zero if it was not specified.
   1.206 -    int line() const { return _line; }
   1.207 +    int line() const throw() { return _line; }
   1.208  
   1.209      /// Returns the error message
   1.210 -    const std::string& message() const {
   1.211 +    const std::string& message() const throw() {
   1.212        return _message;
   1.213      }
   1.214  
   1.215      /// \brief Returns the filename
   1.216      ///
   1.217 -    /// Returns the filename or empty string if the filename was not
   1.218 -    /// specified.
   1.219 -    const std::string& file() const {
   1.220 +    /// Returns the filename or an empty string if it was not specified.
   1.221 +    const std::string& file() const throw() {
   1.222        return _file;
   1.223      }
   1.224  
   1.225 @@ -252,12 +252,12 @@
   1.226          _what.clear();
   1.227          std::ostringstream oss;
   1.228          oss << "lemon:FormatError" << ": ";
   1.229 -        oss << message();
   1.230 -        if (!file().empty() || line() != 0) {
   1.231 +        oss << _message;
   1.232 +        if (!_file.empty() || _line != 0) {
   1.233            oss << " (";
   1.234 -          if (!file().empty()) oss << "in file '" << file() << "'";
   1.235 -          if (!file().empty() && line() != 0) oss << " ";
   1.236 -          if (line() != 0) oss << "at line " << line();
   1.237 +          if (!_file.empty()) oss << "in file '" << _file << "'";
   1.238 +          if (!_file.empty() && _line != 0) oss << " ";
   1.239 +          if (_line != 0) oss << "at line " << _line;
   1.240            oss << ")";
   1.241          }
   1.242          _what = oss.str();
     2.1 --- a/lemon/graph_to_eps.h	Tue Sep 30 20:53:18 2008 +0200
     2.2 +++ b/lemon/graph_to_eps.h	Wed Oct 01 11:58:03 2008 +0200
     2.3 @@ -1170,7 +1170,7 @@
     2.4    std::ostream* os = new std::ofstream(file_name);
     2.5    if (!(*os)) {
     2.6      delete os;
     2.7 -    throw IoError(file_name, "Cannot write file");
     2.8 +    throw IoError("Cannot write file", file_name);
     2.9    }
    2.10    return GraphToEps<DefaultGraphToEpsTraits<G> >
    2.11      (DefaultGraphToEpsTraits<G>(g,*os,true));
    2.12 @@ -1191,7 +1191,7 @@
    2.13    std::ostream* os = new std::ofstream(file_name.c_str());
    2.14    if (!(*os)) {
    2.15      delete os;
    2.16 -    throw IoError(file_name, "Cannot write file");
    2.17 +    throw IoError("Cannot write file", file_name);
    2.18    }
    2.19    return GraphToEps<DefaultGraphToEpsTraits<G> >
    2.20      (DefaultGraphToEpsTraits<G>(g,*os,true));
     3.1 --- a/lemon/lgf_reader.h	Tue Sep 30 20:53:18 2008 +0200
     3.2 +++ b/lemon/lgf_reader.h	Wed Oct 01 11:58:03 2008 +0200
     3.3 @@ -516,7 +516,7 @@
     3.4          _filename(fn), _digraph(digraph),
     3.5          _use_nodes(false), _use_arcs(false),
     3.6          _skip_nodes(false), _skip_arcs(false) {
     3.7 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
     3.8 +      if (!(*_is)) throw IoError("Cannot open file", fn);
     3.9      }
    3.10  
    3.11      /// \brief Constructor
    3.12 @@ -528,7 +528,7 @@
    3.13          _filename(fn), _digraph(digraph),
    3.14          _use_nodes(false), _use_arcs(false),
    3.15          _skip_nodes(false), _skip_arcs(false) {
    3.16 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
    3.17 +      if (!(*_is)) throw IoError("Cannot open file", fn);
    3.18      }
    3.19  
    3.20      /// \brief Destructor
    3.21 @@ -879,7 +879,7 @@
    3.22              maps.find(_node_maps[i].first);
    3.23            if (jt == maps.end()) {
    3.24              std::ostringstream msg;
    3.25 -            msg << "Map not found in file: " << _node_maps[i].first;
    3.26 +            msg << "Map not found: " << _node_maps[i].first;
    3.27              throw FormatError(msg.str());
    3.28            }
    3.29            map_index[i] = jt->second;
    3.30 @@ -908,7 +908,7 @@
    3.31            }
    3.32          }
    3.33          if (line >> std::ws >> c)
    3.34 -          throw FormatError("Extra character on the end of line");
    3.35 +          throw FormatError("Extra character at the end of line");
    3.36  
    3.37          Node n;
    3.38          if (!_use_nodes) {
    3.39 @@ -917,7 +917,7 @@
    3.40              _node_index.insert(std::make_pair(tokens[label_index], n));
    3.41          } else {
    3.42            if (label_index == -1)
    3.43 -            throw FormatError("Label map not found in file");
    3.44 +            throw FormatError("Label map not found");
    3.45            typename std::map<std::string, Node>::iterator it =
    3.46              _node_index.find(tokens[label_index]);
    3.47            if (it == _node_index.end()) {
    3.48 @@ -972,7 +972,7 @@
    3.49              maps.find(_arc_maps[i].first);
    3.50            if (jt == maps.end()) {
    3.51              std::ostringstream msg;
    3.52 -            msg << "Map not found in file: " << _arc_maps[i].first;
    3.53 +            msg << "Map not found: " << _arc_maps[i].first;
    3.54              throw FormatError(msg.str());
    3.55            }
    3.56            map_index[i] = jt->second;
    3.57 @@ -1010,7 +1010,7 @@
    3.58            }
    3.59          }
    3.60          if (line >> std::ws >> c)
    3.61 -          throw FormatError("Extra character on the end of line");
    3.62 +          throw FormatError("Extra character at the end of line");
    3.63  
    3.64          Arc a;
    3.65          if (!_use_arcs) {
    3.66 @@ -1038,7 +1038,7 @@
    3.67              _arc_index.insert(std::make_pair(tokens[label_index], a));
    3.68          } else {
    3.69            if (label_index == -1)
    3.70 -            throw FormatError("Label map not found in file");
    3.71 +            throw FormatError("Label map not found");
    3.72            typename std::map<std::string, Arc>::iterator it =
    3.73              _arc_index.find(tokens[label_index]);
    3.74            if (it == _arc_index.end()) {
    3.75 @@ -1073,13 +1073,13 @@
    3.76          if (!_reader_bits::readToken(line, token))
    3.77            throw FormatError("Attribute value not found");
    3.78          if (line >> c)
    3.79 -          throw FormatError("Extra character on the end of line");
    3.80 +          throw FormatError("Extra character at the end of line");
    3.81  
    3.82          {
    3.83            std::set<std::string>::iterator it = read_attr.find(attr);
    3.84            if (it != read_attr.end()) {
    3.85              std::ostringstream msg;
    3.86 -            msg << "Multiple occurence of attribute " << attr;
    3.87 +            msg << "Multiple occurence of attribute: " << attr;
    3.88              throw FormatError(msg.str());
    3.89            }
    3.90            read_attr.insert(attr);
    3.91 @@ -1101,7 +1101,7 @@
    3.92             it != _attributes.end(); ++it) {
    3.93          if (read_attr.find(it->first) == read_attr.end()) {
    3.94            std::ostringstream msg;
    3.95 -          msg << "Attribute not found in file: " << it->first;
    3.96 +          msg << "Attribute not found: " << it->first;
    3.97            throw FormatError(msg.str());
    3.98          }
    3.99        }
   3.100 @@ -1117,9 +1117,6 @@
   3.101      /// This function starts the batch processing
   3.102      void run() {
   3.103        LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
   3.104 -      if (!*_is) {
   3.105 -        throw FormatError("Cannot find file");
   3.106 -      }
   3.107  
   3.108        bool nodes_done = _skip_nodes;
   3.109        bool arcs_done = _skip_arcs;
   3.110 @@ -1138,7 +1135,7 @@
   3.111            _reader_bits::readToken(line, caption);
   3.112  
   3.113            if (line >> c)
   3.114 -            throw FormatError("Extra character on the end of line");
   3.115 +            throw FormatError("Extra character at the end of line");
   3.116  
   3.117            if (section == "nodes" && !nodes_done) {
   3.118              if (_nodes_caption.empty() || _nodes_caption == caption) {
   3.119 @@ -1308,7 +1305,7 @@
   3.120          _filename(fn), _graph(graph),
   3.121          _use_nodes(false), _use_edges(false),
   3.122          _skip_nodes(false), _skip_edges(false) {
   3.123 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
   3.124 +      if (!(*_is)) throw IoError("Cannot open file", fn);
   3.125      }
   3.126  
   3.127      /// \brief Constructor
   3.128 @@ -1320,7 +1317,7 @@
   3.129          _filename(fn), _graph(graph),
   3.130          _use_nodes(false), _use_edges(false),
   3.131          _skip_nodes(false), _skip_edges(false) {
   3.132 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
   3.133 +      if (!(*_is)) throw IoError("Cannot open file", fn);
   3.134      }
   3.135  
   3.136      /// \brief Destructor
   3.137 @@ -1715,7 +1712,7 @@
   3.138              maps.find(_node_maps[i].first);
   3.139            if (jt == maps.end()) {
   3.140              std::ostringstream msg;
   3.141 -            msg << "Map not found in file: " << _node_maps[i].first;
   3.142 +            msg << "Map not found: " << _node_maps[i].first;
   3.143              throw FormatError(msg.str());
   3.144            }
   3.145            map_index[i] = jt->second;
   3.146 @@ -1744,7 +1741,7 @@
   3.147            }
   3.148          }
   3.149          if (line >> std::ws >> c)
   3.150 -          throw FormatError("Extra character on the end of line");
   3.151 +          throw FormatError("Extra character at the end of line");
   3.152  
   3.153          Node n;
   3.154          if (!_use_nodes) {
   3.155 @@ -1753,7 +1750,7 @@
   3.156              _node_index.insert(std::make_pair(tokens[label_index], n));
   3.157          } else {
   3.158            if (label_index == -1)
   3.159 -            throw FormatError("Label map not found in file");
   3.160 +            throw FormatError("Label map not found");
   3.161            typename std::map<std::string, Node>::iterator it =
   3.162              _node_index.find(tokens[label_index]);
   3.163            if (it == _node_index.end()) {
   3.164 @@ -1808,7 +1805,7 @@
   3.165              maps.find(_edge_maps[i].first);
   3.166            if (jt == maps.end()) {
   3.167              std::ostringstream msg;
   3.168 -            msg << "Map not found in file: " << _edge_maps[i].first;
   3.169 +            msg << "Map not found: " << _edge_maps[i].first;
   3.170              throw FormatError(msg.str());
   3.171            }
   3.172            map_index[i] = jt->second;
   3.173 @@ -1846,7 +1843,7 @@
   3.174            }
   3.175          }
   3.176          if (line >> std::ws >> c)
   3.177 -          throw FormatError("Extra character on the end of line");
   3.178 +          throw FormatError("Extra character at the end of line");
   3.179  
   3.180          Edge e;
   3.181          if (!_use_edges) {
   3.182 @@ -1874,7 +1871,7 @@
   3.183              _edge_index.insert(std::make_pair(tokens[label_index], e));
   3.184          } else {
   3.185            if (label_index == -1)
   3.186 -            throw FormatError("Label map not found in file");
   3.187 +            throw FormatError("Label map not found");
   3.188            typename std::map<std::string, Edge>::iterator it =
   3.189              _edge_index.find(tokens[label_index]);
   3.190            if (it == _edge_index.end()) {
   3.191 @@ -1909,13 +1906,13 @@
   3.192          if (!_reader_bits::readToken(line, token))
   3.193            throw FormatError("Attribute value not found");
   3.194          if (line >> c)
   3.195 -          throw FormatError("Extra character on the end of line");
   3.196 +          throw FormatError("Extra character at the end of line");
   3.197  
   3.198          {
   3.199            std::set<std::string>::iterator it = read_attr.find(attr);
   3.200            if (it != read_attr.end()) {
   3.201              std::ostringstream msg;
   3.202 -            msg << "Multiple occurence of attribute " << attr;
   3.203 +            msg << "Multiple occurence of attribute: " << attr;
   3.204              throw FormatError(msg.str());
   3.205            }
   3.206            read_attr.insert(attr);
   3.207 @@ -1937,7 +1934,7 @@
   3.208             it != _attributes.end(); ++it) {
   3.209          if (read_attr.find(it->first) == read_attr.end()) {
   3.210            std::ostringstream msg;
   3.211 -          msg << "Attribute not found in file: " << it->first;
   3.212 +          msg << "Attribute not found: " << it->first;
   3.213            throw FormatError(msg.str());
   3.214          }
   3.215        }
   3.216 @@ -1972,7 +1969,7 @@
   3.217            _reader_bits::readToken(line, caption);
   3.218  
   3.219            if (line >> c)
   3.220 -            throw FormatError("Extra character on the end of line");
   3.221 +            throw FormatError("Extra character at the end of line");
   3.222  
   3.223            if (section == "nodes" && !nodes_done) {
   3.224              if (_nodes_caption.empty() || _nodes_caption == caption) {
   3.225 @@ -2095,7 +2092,7 @@
   3.226      SectionReader(const std::string& fn)
   3.227        : _is(new std::ifstream(fn.c_str())), local_is(true),
   3.228          _filename(fn) {
   3.229 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
   3.230 +      if (!(*_is)) throw IoError("Cannot open file", fn);
   3.231      }
   3.232  
   3.233      /// \brief Constructor
   3.234 @@ -2104,7 +2101,7 @@
   3.235      SectionReader(const char* fn)
   3.236        : _is(new std::ifstream(fn)), local_is(true),
   3.237          _filename(fn) {
   3.238 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
   3.239 +      if (!(*_is)) throw IoError("Cannot open file", fn);
   3.240      }
   3.241  
   3.242      /// \brief Destructor
   3.243 @@ -2261,11 +2258,11 @@
   3.244            _reader_bits::readToken(line, caption);
   3.245  
   3.246            if (line >> c)
   3.247 -            throw FormatError("Extra character on the end of line");
   3.248 +            throw FormatError("Extra character at the end of line");
   3.249  
   3.250            if (extra_sections.find(section) != extra_sections.end()) {
   3.251              std::ostringstream msg;
   3.252 -            msg << "Multiple occurence of section " << section;
   3.253 +            msg << "Multiple occurence of section: " << section;
   3.254              throw FormatError(msg.str());
   3.255            }
   3.256            Sections::iterator it = _sections.find(section);
   3.257 @@ -2387,7 +2384,7 @@
   3.258      /// file.
   3.259      LgfContents(const std::string& fn)
   3.260        : _is(new std::ifstream(fn.c_str())), local_is(true) {
   3.261 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
   3.262 +      if (!(*_is)) throw IoError("Cannot open file", fn);
   3.263      }
   3.264  
   3.265      /// \brief Constructor
   3.266 @@ -2396,7 +2393,7 @@
   3.267      /// file.
   3.268      LgfContents(const char* fn)
   3.269        : _is(new std::ifstream(fn)), local_is(true) {
   3.270 -      if (!(*_is)) throw IoError(fn, "Cannot open file");
   3.271 +      if (!(*_is)) throw IoError("Cannot open file", fn);
   3.272      }
   3.273  
   3.274      /// \brief Destructor
     4.1 --- a/lemon/lgf_writer.h	Tue Sep 30 20:53:18 2008 +0200
     4.2 +++ b/lemon/lgf_writer.h	Wed Oct 01 11:58:03 2008 +0200
     4.3 @@ -463,7 +463,7 @@
     4.4      DigraphWriter(const std::string& fn, const Digraph& digraph)
     4.5        : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
     4.6          _skip_nodes(false), _skip_arcs(false) {
     4.7 -      if (!(*_os)) throw IoError(fn, "Cannot write file");
     4.8 +      if (!(*_os)) throw IoError("Cannot write file", fn);
     4.9      }
    4.10  
    4.11      /// \brief Constructor
    4.12 @@ -473,7 +473,7 @@
    4.13      DigraphWriter(const char* fn, const Digraph& digraph)
    4.14        : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
    4.15          _skip_nodes(false), _skip_arcs(false) {
    4.16 -      if (!(*_os)) throw IoError(fn, "Cannot write file");
    4.17 +      if (!(*_os)) throw IoError("Cannot write file", fn);
    4.18      }
    4.19  
    4.20      /// \brief Destructor
    4.21 @@ -1023,7 +1023,7 @@
    4.22      GraphWriter(const std::string& fn, const Graph& graph)
    4.23        : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
    4.24          _skip_nodes(false), _skip_edges(false) {
    4.25 -      if (!(*_os)) throw IoError(fn, "Cannot write file");
    4.26 +      if (!(*_os)) throw IoError("Cannot write file", fn);
    4.27      }
    4.28  
    4.29      /// \brief Constructor
    4.30 @@ -1033,7 +1033,7 @@
    4.31      GraphWriter(const char* fn, const Graph& graph)
    4.32        : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
    4.33          _skip_nodes(false), _skip_edges(false) {
    4.34 -      if (!(*_os)) throw IoError(fn, "Cannot write file");
    4.35 +      if (!(*_os)) throw IoError("Cannot write file", fn);
    4.36      }
    4.37  
    4.38      /// \brief Destructor
    4.39 @@ -1585,7 +1585,7 @@
    4.40      /// Construct a section writer, which writes into the given file.
    4.41      SectionWriter(const std::string& fn)
    4.42        : _os(new std::ofstream(fn.c_str())), local_os(true) {
    4.43 -      if (!(*_os)) throw IoError(fn, "Cannot write file");
    4.44 +      if (!(*_os)) throw IoError("Cannot write file", fn);
    4.45      }
    4.46  
    4.47      /// \brief Constructor
    4.48 @@ -1593,7 +1593,7 @@
    4.49      /// Construct a section writer, which writes into the given file.
    4.50      SectionWriter(const char* fn)
    4.51        : _os(new std::ofstream(fn)), local_os(true) {
    4.52 -      if (!(*_os)) throw IoError(fn, "Cannot write file");
    4.53 +      if (!(*_os)) throw IoError("Cannot write file", fn);
    4.54      }
    4.55  
    4.56      /// \brief Destructor