@@ -80,7 +80,7 @@ class GndTruthMsgPackSerializer
80
80
class GndTruthSerializer {
81
81
public:
82
82
virtual ~GndTruthSerializer () = 0 ;
83
- virtual void open_file (const std::string& filename) = 0;
83
+ virtual bool open_file (const std::string& filename) = 0;
84
84
virtual void serialize (const Sync& sync, const GndTruth& gt) = 0;
85
85
virtual void close_file () = 0;
86
86
@@ -103,10 +103,12 @@ class GndTruthSerializerImpl
103
103
GndTruthSerializerImpl (Logger logger) : base1(logger), GndTruthSerializer() {}
104
104
virtual ~GndTruthSerializerImpl () override ;
105
105
using base1::open_file;
106
- virtual void open_file (const std::string& filename) override {
106
+
107
+ [[nodiscard]]
108
+ virtual bool open_file (const std::string& filename) override {
107
109
std::string default_name = this ->outputstream_ .make_default_filename (
108
110
this ->serializer_ .make_default_filename (default_filename));
109
- base1::open_file (filename, default_name);
111
+ return base1::open_file (filename, default_name);
110
112
}
111
113
virtual void serialize (const Sync& sync, const GndTruth& gt) override {
112
114
base1::serialize (sync , gt);
@@ -219,7 +221,10 @@ class GndTruthExtractor : public Controller {
219
221
private:
220
222
void open_file () {
221
223
if (serializer_) {
222
- serializer_->open_file (config_.output_file );
224
+ bool ok = serializer_->open_file (config_.output_file );
225
+ if (!ok) {
226
+ throw cloe::ModelAbort (" cannot open file: {}" , config_.output_file );
227
+ }
223
228
}
224
229
}
225
230
void close_file () {
0 commit comments