File: lang_detect_exception.py

package info (click to toggle)
python-langdetect 1.0.9-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,572 kB
  • sloc: python: 1,226; makefile: 6
file content (22 lines) | stat: -rwxr-xr-x 519 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
_error_codes = {
    'NoTextError': 0,
    'FormatError': 1,
    'FileLoadError': 2,
    'DuplicateLangError': 3,
    'NeedLoadProfileError': 4,
    'CantDetectError': 5,
    'CantOpenTrainData': 6,
    'TrainDataFormatError': 7,
    'InitParamError': 8,
}

ErrorCode = type('ErrorCode', (), _error_codes)


class LangDetectException(Exception):
    def __init__(self, code, message):
        super(LangDetectException, self).__init__(message)
        self.code = code

    def get_code(self):
        return self.code