-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy patherrors.py
38 lines (28 loc) · 1 KB
/
errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
###########################################################################
# Sint Wind PI
# Copyright 2012 by Tonino Tarsi <[email protected]>
# Modem comunications based on Slawek Ligus pyhumod-0.03 module
#
# Please refer to the LICENSE file for conditions
# Visit http://www.vololiberomontecucco.it
#
##########################################################################
"""Exceptions and error-handling methods."""
from TTLib import *
ERROR_CODES = ['COMMAND NOT SUPPORT', 'ERR', 'NO CARRIER', 'BUSY']
class Error(Exception):
"""Generic Exception."""
pass
class AtCommandError(Error):
"""AT Command exception."""
pass
class PppdError(Error):
"""PPPD fork-exec exception."""
pass
class HumodUsageError(Error):
"""Humod usage error exception."""
pass
def check_for_errors(input_line):
"""Check if input line contains error code."""
if ('ERROR' in input_line) or (input_line in ERROR_CODES):
raise AtCommandError, input_line