Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "DataFormats/PatCandidates/interface/throwMissingLabel.h"

#include "FWCore/Utilities/interface/Exception.h"
#include <iostream>

namespace pat {
  void throwMissingLabel(const std::string& what,
                         const std::string& bad_label,
                         const std::vector<std::string>& available) {
    cms::Exception ex(std::string("Unknown") + what);
    ex << "Requested " << what << " " << bad_label << " is not available! Possible " << what << "s are: " << std::endl;
    for (const auto& name : available) {
      ex << name << ' ';
    }
    throw ex;
  }
}  // namespace pat