ThrowingAnalyzer_module.cc
Go to the documentation of this file.
5 #include "fhiclcpp/types/Atom.h"
6 
7 namespace art {
8  namespace test {
9  class ThrowingAnalyzer;
10  }
11 } // namespace art
12 
14  unsigned count_{};
15  unsigned threshold_;
16 
17 public:
19 
21  : EDAnalyzer{p}, threshold_{p().throwAfter()}
22  {
23  if (p().throwFromCtor()) {
24  throw Exception{errors::OtherArt} << "Throw from c'tor.\n";
25  }
26  }
27 
28  void
29  analyze(Event const&) override
30  {
31  if (++count_ > threshold_) {
32  throw Exception{errors::OtherArt} << "Throw from analyze.\n";
33  }
34  }
35 };
36 
Definition: test.py:1
void analyze(Event const &) override
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
p
Definition: test.py:228
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66