Changeset 3ece5dd in sasview for src/sas/sascalc/data_util


Ignore:
Timestamp:
Jul 26, 2017 6:31:27 AM (7 years ago)
Author:
lewis
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
bc570f4
Parents:
371b9e2
Message:

Raise and catch correct exceptions in CanSAS XML reader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/data_util/registry.py

    r5d8f9b3 r3ece5dd  
    2626        registry['.tar.gz'] = untar 
    2727 
    28         # Generic extensions to use after trying more specific extensions;  
     28        # Generic extensions to use after trying more specific extensions; 
    2929        # these will be checked after the more specific extensions fail. 
    3030        registry['.gz'] = gunzip 
     
    9292        """ 
    9393        Return the loader associated with the file type of path. 
    94          
     94 
    9595        :param path: Data file path 
    9696        :raises ValueError: When no loaders are found for the file. 
    9797        :return: List of available readers for the file extension 
    98         """         
     98        """ 
    9999        # Find matching extensions 
    100100        extlist = [ext for ext in self.extensions() if path.endswith(ext)] 
     
    135135            except KeyError as e: 
    136136                pass 
     137        last_exc = None 
    137138        for fn in loaders: 
    138139            try: 
    139140                return fn(path) 
    140141            except Exception as e: 
     142                last_exc = e 
    141143                pass  # give other loaders a chance to succeed 
    142144        # If we get here it is because all loaders failed 
     145        if last_exc is not None and len(loaders) != 0: 
     146            # If file has associated loader(s) and they;ve failed 
     147            raise last_exc 
    143148        raise NoKnownLoaderException(e.message)  # raise generic exception 
Note: See TracChangeset for help on using the changeset viewer.