Ignore:
Timestamp:
Apr 5, 2017 9:08:59 AM (7 years ago)
Author:
krzywon
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:
278ddee
Parents:
69400ec
git-author:
Jeff Krzywon <krzywon@…> (04/05/17 09:08:59)
git-committer:
krzywon <krzywon@…> (04/05/17 09:08:59)
Message:

More explicit error messages when file loading fails. see #889

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/ascii_reader.py

    r9a5097c r7f75a3f  
    1717import os 
    1818from sas.sascalc.dataloader.data_info import Data1D 
     19from sas.sascalc.dataloader.loader_exceptions import FileContentsException 
    1920 
    2021# Check whether we have a converter available 
     
    173174                if not is_data: 
    174175                    msg = "ascii_reader: x has no data" 
    175                     raise RuntimeError, msg 
     176                    raise FileContentsException, msg 
    176177                # Sanity check 
    177178                if has_error_dy == True and not len(ty) == len(tdy): 
    178179                    msg = "ascii_reader: y and dy have different length" 
    179                     raise RuntimeError, msg 
     180                    raise FileContentsException, msg 
    180181                if has_error_dx == True and not len(tx) == len(tdx): 
    181182                    msg = "ascii_reader: y and dy have different length" 
    182                     raise RuntimeError, msg 
     183                    raise FileContentsException, msg 
    183184                # If the data length is zero, consider this as 
    184185                # though we were not able to read the file. 
    185186                if len(tx) == 0: 
    186                     raise RuntimeError, "ascii_reader: could not load file" 
     187                    raise FileContentsException, "ascii_reader: could not load file" 
    187188 
    188189                #Let's re-order the data to make cal. 
Note: See TracChangeset for help on using the changeset viewer.