Project

General

Profile

Feature #3105

Product Not Found exception is not caught for art::Event::getView()

Added by Brian Rebel almost 7 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Event Loop
Target version:
-
Start date:
11/03/2012
Due date:
% Done:

0%

Estimated time:
Scope:
Internal
Experiment:
-
SSI Package:
Duration:

Description

If a product is not found using art::Event::getView() the thrown exception is not caught, unlike for art::Event::getByLabel. It would be great if the exception were caught for both.

Hopefully this is an easy fix and can go into the next release.

History

#1 Updated by Christopher Green over 6 years ago

  • Tracker changed from Bug to Feature
  • Category set to Event Loop
  • Status changed from New to Rejected

This is not a bug, per se. The getView() interface currently has no way to allow the user to distinguish between a getView() call that could not retrieve the desired collection and one where the collection existed but was empty.

I think the best solution going forward is to catch the exception yourself:

try {
  getView(...);
}
catch (art::Exception const & e) {
  if (e.categoryCode() != art::Exception::errors::ProductNotFound) {
    throw;
  }
}

We can discuss this further, but the only thing I can envisage doing on the art side is to provide "noFail" variants of the @getView()@ function. Please let me know if you want to move ahead with this and I can resurrect this ticket.



Also available in: Atom PDF