source: sasview/src/sas/sascalc/dataloader/loader_exceptions.py @ 41d6187

Last change on this file since 41d6187 was 3ece5dd, checked in by lewis, 7 years ago

Raise and catch correct exceptions in CanSAS XML reader

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[270c882b]1"""
2Exceptions specific to loading data.
3"""
4
5
6class NoKnownLoaderException(Exception):
7    """
8    Exception for files with no associated reader based on the file
9    extension of the loaded file. This exception should only be thrown by
10    loader.py.
11    """
[3ece5dd]12    def __init__(self, e=None):
[270c882b]13        self.message = e
14
15
[371b9e2]16class DefaultReaderException(Exception):
[270c882b]17    """
[371b9e2]18    Exception for files with no associated reader. This should be thrown by
19    default readers only to tell Loader to try the next reader.
[270c882b]20    """
[3ece5dd]21    def __init__(self, e=None):
[270c882b]22        self.message = e
23
24
[371b9e2]25class FileContentsException(Exception):
[da8bb53]26    """
[371b9e2]27    Exception for files with an associated reader, but with no loadable data.
28    This is useful for catching loader or file format issues.
[da8bb53]29    """
[3ece5dd]30    def __init__(self, e=None):
[da8bb53]31        self.message = e
32
33
[270c882b]34class DataReaderException(Exception):
35    """
36    Exception for files that were able to mostly load, but had minor issues
37    along the way.
38    Any exceptions of this type should be put into the datainfo.errors
39    """
[3ece5dd]40    def __init__(self, e=None):
41        self.message = e
Note: See TracBrowser for help on using the repository browser.