Index: lemon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 291)
+++ lemon/lgf_reader.h	(revision 293)
@@ -49,11 +49,9 @@
         std::istringstream is(str);
         Value value;
-        if (!(is >> value)) {
-          throw FormatError("Cannot read token");
-        }
+        is >> value;
 
         char c;
         if (is >> std::ws >> c) {
-          throw FormatError("Remaining characters in token");
+          throw DataFormatError("Remaining characters in token");
         }
         return value;
@@ -169,5 +167,5 @@
           std::ostringstream msg;
           msg << "Item not found: " << str;
-          throw FormatError(msg.str());
+          throw DataFormatError(msg.str().c_str());
         }
         return it->second;
@@ -187,10 +185,10 @@
       typename Graph::Arc operator()(const std::string& str) {
         if (str.empty() || (str[0] != '+' && str[0] != '-')) {
-          throw FormatError("Item must start with '+' or '-'");
+          throw DataFormatError("Item must start with '+' or '-'");
         }
         typename std::map<std::string, typename Graph::Edge>
           ::const_iterator it = _map.find(str.substr(1));
         if (it == _map.end()) {
-          throw FormatError("Item not found");
+          throw DataFormatError("Item not found");
         }
         return _graph.direct(it->second, str[0] == '+');
@@ -238,5 +236,5 @@
       char c;
       if (!is.get(c))
-        throw FormatError("Escape format error");
+        throw DataFormatError("Escape format error");
 
       switch (c) {
@@ -267,5 +265,5 @@
           int code;
           if (!is.get(c) || !isHex(c))
-            throw FormatError("Escape format error");
+            throw DataFormatError("Escape format error");
           else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
           else code = code * 16 + valueHex(c);
@@ -276,5 +274,5 @@
           int code;
           if (!isOct(c))
-            throw FormatError("Escape format error");
+            throw DataFormatError("Escape format error");
           else if (code = valueOct(c), !is.get(c) || !isOct(c))
             is.putback(c);
@@ -303,5 +301,5 @@
         }
         if (!is)
-          throw FormatError("Quoted format error");
+          throw DataFormatError("Quoted format error");
       } else {
         is.putback(c);
@@ -393,11 +391,12 @@
 
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       std::istream& is = std::cin);
 
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const std::string& fn, Digraph& digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn);
 
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const char *fn, Digraph& digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn);
 
   /// \ingroup lemon_io
@@ -422,5 +421,5 @@
   ///
   ///\code
-  /// DigraphReader<Digraph>(std::cin, digraph).
+  /// DigraphReader<Digraph>(digraph, std::cin).
   ///   nodeMap("coordinates", coord_map).
   ///   arcMap("capacity", cap_map).
@@ -463,5 +462,4 @@
     std::istream* _is;
     bool local_is;
-    std::string _filename;
 
     Digraph& _digraph;
@@ -503,5 +501,5 @@
     /// Construct a directed graph reader, which reads from the given
     /// input stream.
-    DigraphReader(std::istream& is, Digraph& digraph)
+    DigraphReader(Digraph& digraph, std::istream& is = std::cin)
       : _is(&is), local_is(false), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
@@ -512,11 +510,8 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(const std::string& fn, Digraph& digraph)
-      : _is(new std::ifstream(fn.c_str())), local_is(true),
-        _filename(fn), _digraph(digraph),
+    DigraphReader(Digraph& digraph, const std::string& fn)
+      : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
-        _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Constructor
@@ -524,11 +519,8 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(const char* fn, Digraph& digraph)
-      : _is(new std::ifstream(fn)), local_is(true),
-        _filename(fn), _digraph(digraph),
+    DigraphReader(Digraph& digraph, const char* fn)
+      : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
-        _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Destructor
@@ -557,10 +549,10 @@
   private:
 
-    friend DigraphReader<Digraph> digraphReader<>(std::istream& is,
-                                                  Digraph& digraph);
-    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn,
-                                                  Digraph& digraph);
-    friend DigraphReader<Digraph> digraphReader<>(const char *fn,
-                                                  Digraph& digraph);
+    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
+                                                  std::istream& is);
+    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
+                                                  const std::string& fn);
+    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
+                                                  const char *fn);
 
     DigraphReader(DigraphReader& other)
@@ -855,5 +847,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_node_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -869,5 +861,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of node map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -880,6 +872,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _node_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _node_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -905,9 +897,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Node n;
@@ -918,5 +910,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Node>::iterator it =
             _node_index.find(tokens[label_index]);
@@ -924,5 +916,5 @@
             std::ostringstream msg;
             msg << "Node with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           n = it->second;
@@ -948,5 +940,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_arc_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -962,5 +954,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of arc map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -973,6 +965,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _arc_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _arc_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -997,8 +989,8 @@
 
         if (!_reader_bits::readToken(line, source_token))
-          throw FormatError("Source not found");
+          throw DataFormatError("Source not found");
 
         if (!_reader_bits::readToken(line, target_token))
-          throw FormatError("Target not found");
+          throw DataFormatError("Target not found");
 
         std::vector<std::string> tokens(map_num);
@@ -1007,9 +999,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Arc a;
@@ -1022,5 +1014,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << source_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node source = it->second;
@@ -1030,5 +1022,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << target_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node target = it->second;
@@ -1039,5 +1031,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Arc>::iterator it =
             _arc_index.find(tokens[label_index]);
@@ -1045,5 +1037,5 @@
             std::ostringstream msg;
             msg << "Arc with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           a = it->second;
@@ -1070,9 +1062,9 @@
         std::string attr, token;
         if (!_reader_bits::readToken(line, attr))
-          throw FormatError("Attribute name not found");
+          throw DataFormatError("Attribute name not found");
         if (!_reader_bits::readToken(line, token))
-          throw FormatError("Attribute value not found");
+          throw DataFormatError("Attribute value not found");
         if (line >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         {
@@ -1080,6 +1072,6 @@
           if (it != read_attr.end()) {
             std::ostringstream msg;
-            msg << "Multiple occurence of attribute: " << attr;
-            throw FormatError(msg.str());
+            msg << "Multiple occurence of attribute " << attr;
+            throw DataFormatError(msg.str().c_str());
           }
           read_attr.insert(attr);
@@ -1102,6 +1094,6 @@
         if (read_attr.find(it->first) == read_attr.end()) {
           std::ostringstream msg;
-          msg << "Attribute not found: " << it->first;
-          throw FormatError(msg.str());
+          msg << "Attribute not found in file: " << it->first;
+          throw DataFormatError(msg.str().c_str());
         }
       }
@@ -1118,4 +1110,7 @@
     void run() {
       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
+      if (!*_is) {
+        throw DataFormatError("Cannot find file");
+      }
 
       bool nodes_done = _skip_nodes;
@@ -1136,5 +1131,5 @@
 
           if (line >> c)
-            throw FormatError("Extra character at the end of line");
+            throw DataFormatError("Extra character on the end of line");
 
           if (section == "nodes" && !nodes_done) {
@@ -1158,7 +1153,6 @@
             skipSection();
           }
-        } catch (FormatError& error) {
+        } catch (DataFormatError& error) {
           error.line(line_num);
-          error.file(_filename);
           throw;
         }
@@ -1166,13 +1160,13 @@
 
       if (!nodes_done) {
-        throw FormatError("Section @nodes not found");
+        throw DataFormatError("Section @nodes not found");
       }
 
       if (!arcs_done) {
-        throw FormatError("Section @arcs not found");
+        throw DataFormatError("Section @arcs not found");
       }
 
       if (!attributes_done && !_attributes.empty()) {
-        throw FormatError("Section @attributes not found");
+        throw DataFormatError("Section @attributes not found");
       }
 
@@ -1188,6 +1182,7 @@
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
-    DigraphReader<Digraph> tmp(is, digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       std::istream& is = std::cin) {
+    DigraphReader<Digraph> tmp(digraph, is);
     return tmp;
   }
@@ -1198,7 +1193,7 @@
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const std::string& fn,
-                                       Digraph& digraph) {
-    DigraphReader<Digraph> tmp(fn, digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       const std::string& fn) {
+    DigraphReader<Digraph> tmp(digraph, fn);
     return tmp;
   }
@@ -1209,6 +1204,6 @@
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
-    DigraphReader<Digraph> tmp(fn, digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
+    DigraphReader<Digraph> tmp(digraph, fn);
     return tmp;
   }
@@ -1218,11 +1213,12 @@
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);
+  GraphReader<Graph> graphReader(Graph& graph,
+                                 std::istream& is = std::cin);
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);
+  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn);
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(const char *fn, Graph& graph);
+  GraphReader<Graph> graphReader(Graph& graph, const char *fn);
 
   /// \ingroup lemon_io
@@ -1252,5 +1248,4 @@
     std::istream* _is;
     bool local_is;
-    std::string _filename;
 
     Graph& _graph;
@@ -1292,5 +1287,5 @@
     /// Construct an undirected graph reader, which reads from the given
     /// input stream.
-    GraphReader(std::istream& is, Graph& graph)
+    GraphReader(Graph& graph, std::istream& is = std::cin)
       : _is(&is), local_is(false), _graph(graph),
         _use_nodes(false), _use_edges(false),
@@ -1301,11 +1296,8 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(const std::string& fn, Graph& graph)
-      : _is(new std::ifstream(fn.c_str())), local_is(true),
-        _filename(fn), _graph(graph),
+    GraphReader(Graph& graph, const std::string& fn)
+      : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph),
         _use_nodes(false), _use_edges(false),
-        _skip_nodes(false), _skip_edges(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Constructor
@@ -1313,11 +1305,8 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(const char* fn, Graph& graph)
-      : _is(new std::ifstream(fn)), local_is(true),
-        _filename(fn), _graph(graph),
+    GraphReader(Graph& graph, const char* fn)
+      : _is(new std::ifstream(fn)), local_is(true), _graph(graph),
         _use_nodes(false), _use_edges(false),
-        _skip_nodes(false), _skip_edges(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Destructor
@@ -1345,8 +1334,8 @@
 
   private:
-    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);
-    friend GraphReader<Graph> graphReader<>(const std::string& fn,
-                                            Graph& graph);
-    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);
+    friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is);
+    friend GraphReader<Graph> graphReader<>(Graph& graph,
+                                            const std::string& fn);
+    friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn);
 
     GraphReader(GraphReader& other)
@@ -1688,5 +1677,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_node_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -1702,5 +1691,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of node map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -1713,6 +1702,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _node_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _node_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -1738,9 +1727,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Node n;
@@ -1751,5 +1740,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Node>::iterator it =
             _node_index.find(tokens[label_index]);
@@ -1757,5 +1746,5 @@
             std::ostringstream msg;
             msg << "Node with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           n = it->second;
@@ -1781,5 +1770,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_edge_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -1795,5 +1784,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of edge map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -1806,6 +1795,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _edge_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _edge_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -1830,8 +1819,8 @@
 
         if (!_reader_bits::readToken(line, source_token))
-          throw FormatError("Node u not found");
+          throw DataFormatError("Node u not found");
 
         if (!_reader_bits::readToken(line, target_token))
-          throw FormatError("Node v not found");
+          throw DataFormatError("Node v not found");
 
         std::vector<std::string> tokens(map_num);
@@ -1840,9 +1829,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Edge e;
@@ -1855,5 +1844,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << source_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node source = it->second;
@@ -1863,5 +1852,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << target_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node target = it->second;
@@ -1872,5 +1861,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Edge>::iterator it =
             _edge_index.find(tokens[label_index]);
@@ -1878,5 +1867,5 @@
             std::ostringstream msg;
             msg << "Edge with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           e = it->second;
@@ -1903,9 +1892,9 @@
         std::string attr, token;
         if (!_reader_bits::readToken(line, attr))
-          throw FormatError("Attribute name not found");
+          throw DataFormatError("Attribute name not found");
         if (!_reader_bits::readToken(line, token))
-          throw FormatError("Attribute value not found");
+          throw DataFormatError("Attribute value not found");
         if (line >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         {
@@ -1913,6 +1902,6 @@
           if (it != read_attr.end()) {
             std::ostringstream msg;
-            msg << "Multiple occurence of attribute: " << attr;
-            throw FormatError(msg.str());
+            msg << "Multiple occurence of attribute " << attr;
+            throw DataFormatError(msg.str().c_str());
           }
           read_attr.insert(attr);
@@ -1935,6 +1924,6 @@
         if (read_attr.find(it->first) == read_attr.end()) {
           std::ostringstream msg;
-          msg << "Attribute not found: " << it->first;
-          throw FormatError(msg.str());
+          msg << "Attribute not found in file: " << it->first;
+          throw DataFormatError(msg.str().c_str());
         }
       }
@@ -1970,5 +1959,5 @@
 
           if (line >> c)
-            throw FormatError("Extra character at the end of line");
+            throw DataFormatError("Extra character on the end of line");
 
           if (section == "nodes" && !nodes_done) {
@@ -1992,7 +1981,6 @@
             skipSection();
           }
-        } catch (FormatError& error) {
+        } catch (DataFormatError& error) {
           error.line(line_num);
-          error.file(_filename);
           throw;
         }
@@ -2000,13 +1988,13 @@
 
       if (!nodes_done) {
-        throw FormatError("Section @nodes not found");
+        throw DataFormatError("Section @nodes not found");
       }
 
       if (!edges_done) {
-        throw FormatError("Section @edges not found");
+        throw DataFormatError("Section @edges not found");
       }
 
       if (!attributes_done && !_attributes.empty()) {
-        throw FormatError("Section @attributes not found");
+        throw DataFormatError("Section @attributes not found");
       }
 
@@ -2022,6 +2010,6 @@
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(std::istream& is, Graph& graph) {
-    GraphReader<Graph> tmp(is, graph);
+  GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) {
+    GraphReader<Graph> tmp(graph, is);
     return tmp;
   }
@@ -2032,7 +2020,6 @@
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(const std::string& fn,
-                                       Graph& graph) {
-    GraphReader<Graph> tmp(fn, graph);
+  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
+    GraphReader<Graph> tmp(graph, fn);
     return tmp;
   }
@@ -2043,6 +2030,6 @@
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(const char* fn, Graph& graph) {
-    GraphReader<Graph> tmp(fn, graph);
+  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
+    GraphReader<Graph> tmp(graph, fn);
     return tmp;
   }
@@ -2070,5 +2057,4 @@
     std::istream* _is;
     bool local_is;
-    std::string _filename;
 
     typedef std::map<std::string, _reader_bits::Section*> Sections;
@@ -2091,8 +2077,5 @@
     /// Construct a section reader, which reads from the given file.
     SectionReader(const std::string& fn)
-      : _is(new std::ifstream(fn.c_str())), local_is(true),
-        _filename(fn) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+      : _is(new std::ifstream(fn.c_str())), local_is(true) {}
 
     /// \brief Constructor
@@ -2100,8 +2083,5 @@
     /// Construct a section reader, which reads from the given file.
     SectionReader(const char* fn)
-      : _is(new std::ifstream(fn)), local_is(true),
-        _filename(fn) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+      : _is(new std::ifstream(fn)), local_is(true) {}
 
     /// \brief Destructor
@@ -2259,10 +2239,10 @@
 
           if (line >> c)
-            throw FormatError("Extra character at the end of line");
+            throw DataFormatError("Extra character on the end of line");
 
           if (extra_sections.find(section) != extra_sections.end()) {
             std::ostringstream msg;
-            msg << "Multiple occurence of section: " << section;
-            throw FormatError(msg.str());
+            msg << "Multiple occurence of section " << section;
+            throw DataFormatError(msg.str().c_str());
           }
           Sections::iterator it = _sections.find(section);
@@ -2273,7 +2253,6 @@
           readLine();
           skipSection();
-        } catch (FormatError& error) {
+        } catch (DataFormatError& error) {
           error.line(line_num);
-          error.file(_filename);
           throw;
         }
@@ -2284,5 +2263,5 @@
           std::ostringstream os;
           os << "Cannot find section: " << it->first;
-          throw FormatError(os.str());
+          throw DataFormatError(os.str().c_str());
         }
       }
@@ -2384,7 +2363,5 @@
     /// file.
     LgfContents(const std::string& fn)
-      : _is(new std::ifstream(fn.c_str())), local_is(true) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+      : _is(new std::ifstream(fn.c_str())), local_is(true) {}
 
     /// \brief Constructor
@@ -2393,7 +2370,5 @@
     /// file.
     LgfContents(const char* fn)
-      : _is(new std::ifstream(fn)), local_is(true) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
-    }
+      : _is(new std::ifstream(fn)), local_is(true) {}
 
     /// \brief Destructor
