the class is valid."""
detected = False
+ success = False
for (detector, classname) in self.TYPES:
if detector (self.name_matched_files, self.prot_matched_files):
logging.debug ('Detected type: %s' % p2set)
# Try to have rarslave do it's thing
- ret = p2set.runAll ()
+ try:
+ # Have rarslave do it's thing
+ p2set.runAll ()
- # If something already worked, there is no need to continue,
- # since we've already finished!
- if ret == rsutil.common.SUCCESS:
+ # It succeeded, exit the loop early
+ success = True
break
- else:
- logging.error ('Detected type (%s) failed for: %s' % (p2set,
- self.p2file))
+ except (OSError, RuntimeError):
+ logging.error('Detected type (%s) failed for: %s' % (p2set, self.p2file))
+ except:
+ logging.error('Unknown exception occurred')
+ raise
# Make sure we detected at least one valid type
if not detected:
logging.debug ('The following information will help in writing a detector:')
logging.debug ('name_matches: %s' % self.name_matched_files)
logging.debug ('prot_matches: %s' % self.prot_matched_files)
- return -rsutil.common.EDETECT
# Make sure that something worked
- if ret != rsutil.common.SUCCESS:
- logging.critical ('All types failed for: %s' % self.p2file)
-
- return ret
+ if success == False:
+ logging.critical('All types failed for: %s' % self.p2file)
def main ():
pass