- Timestamp:
- Jul 27, 2017 12:13:00 PM (7 years ago)
- 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
- Location:
- src/sas
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/loader.py
r3ece5dd r8dec7e7 85 85 # TODO: handle error 86 86 raise RuntimeError(e) 87 pass88 87 try: 89 88 cansas_loader = cansas_reader.Reader() … … 94 93 # TODO: Handle errors properly 95 94 raise RuntimeError(e) 96 pass97 95 except Exception as csr: 98 96 # TODO: Modify cansas reader to throw DefaultReaderException … … 101 99 cansas_nexus_loader = cansas_reader_HDF5.Reader() 102 100 return cansas_nexus_loader.read(path) 103 except DefaultReaderException :104 logging.error s("No default loader can load the data")101 except DefaultReaderException as e: 102 logging.error("No default loader can load the data") 105 103 # No known reader available. Give up and throw an error 106 104 msg = "\n\tUnknown data format: %s.\n\tThe file is not a " % path 107 105 msg += "known format that can be loaded by SasView.\n" 108 msg += "Traceback:\n%s" % e.message109 106 raise NoKnownLoaderException, msg 110 except FileContentsException :107 except FileContentsException as e: 111 108 # TODO: Handle error(s) properly 112 pass109 raise RuntimeError(e) 113 110 114 111 def find_plugins(self, dir): -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r0b79323 r8dec7e7 108 108 109 109 basename, _ = os.path.splitext(os.path.basename(xml_file)) 110 # Raises FileContentsException - handled by superclass 111 self.load_file_and_schema(xml_file, schema_path) 112 self.current_datainfo = DataInfo() 110 113 111 try: 112 # Raises FileContentsException 113 self.load_file_and_schema(xml_file, schema_path) 114 self.current_datainfo = DataInfo() 114 115 # Raises FileContentsException if file doesn't meet CanSAS schema 115 116 self.is_cansas(self.extension) -
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r9d786e5 r8dec7e7 13 13 TransmissionSpectrum, Detector 14 14 from sas.sascalc.dataloader.data_info import combine_data_info_with_plottable 15 from sas.sascalc.dataloader.loader_exceptions import FileContentsException 15 from sas.sascalc.dataloader.loader_exceptions import FileContentsException, DefaultReaderException 16 16 from sas.sascalc.dataloader.file_reader_base_class import FileReader 17 17 … … 78 78 self.raw_data = h5py.File(filename, 'r') 79 79 except Exception as e: 80 raise FileContentsException, e 80 if extension not in self.ext: 81 msg = "CanSAS2.0 HDF5 Reader could not load file {}".format(basename + extension) 82 raise DefaultReaderException(msg) 83 raise FileContentsException(e.message) 81 84 # Read in all child elements of top level SASroot 82 85 self.read_children(self.raw_data, []) -
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
r278ddee r8dec7e7 224 224 except NoKnownLoaderException as e: 225 225 logging.error(e.message) 226 error_message = "Loading data failed!\n" + e.message 226 227 self.load_update(output=None, message=e.message, info="warning") 227 228 self.load_complete(output=None, 228 message= "Loading data failed!",229 info=" warning")229 message=error_message, 230 info="error") 230 231 except: 231 232 logger.error(sys.exc_value) … … 268 269 wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 269 270 type="stop")) 270 self.parent.add_data(data_list=output) 271 if output is not None: 272 self.parent.add_data(data_list=output)
Note: See TracChangeset
for help on using the changeset viewer.