Ignore:
Timestamp:
Jul 27, 2017 12:13:00 PM (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:
0615d54
Parents:
9d786e5
Message:

Raise DefaultReaderException? in NXcanSAS reader and handle correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/loader.py

    r3ece5dd r8dec7e7  
    8585            # TODO: handle error 
    8686            raise RuntimeError(e) 
    87             pass 
    8887        try: 
    8988            cansas_loader = cansas_reader.Reader() 
     
    9493            # TODO: Handle errors properly 
    9594            raise RuntimeError(e) 
    96             pass 
    9795        except Exception as csr: 
    9896            # TODO: Modify cansas reader to throw DefaultReaderException 
     
    10199            cansas_nexus_loader = cansas_reader_HDF5.Reader() 
    102100            return cansas_nexus_loader.read(path) 
    103         except DefaultReaderException: 
    104             logging.errors("No default loader can load the data") 
     101        except DefaultReaderException as e: 
     102            logging.error("No default loader can load the data") 
    105103            # No known reader available. Give up and throw an error 
    106104            msg = "\n\tUnknown data format: %s.\n\tThe file is not a " % path 
    107105            msg += "known format that can be loaded by SasView.\n" 
    108             msg += "Traceback:\n%s" % e.message 
    109106            raise NoKnownLoaderException, msg 
    110         except FileContentsException: 
     107        except FileContentsException as e: 
    111108            # TODO: Handle error(s) properly 
    112             pass 
     109            raise RuntimeError(e) 
    113110 
    114111    def find_plugins(self, dir): 
Note: See TracChangeset for help on using the changeset viewer.