forked from Zahner-elektrik/Thales-Remote-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.py
93 lines (69 loc) · 3.9 KB
/
error.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""
____ __ __ __ __ _ __
/_ / ___ _/ / ___ ___ ___________ / /__ / /__/ /_____(_) /__
/ /_/ _ `/ _ \/ _ \/ -_) __/___/ -_) / -_) '_/ __/ __/ / '_/
/___/\_,_/_//_/_//_/\__/_/ \__/_/\__/_/\_\\__/_/ /_/_/\_\
Copyright 2023 Zahner-Elektrik GmbH & Co. KG
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
"""
The following is an example for troubleshooting when an exception is thrown.
----Example exception----
Traceback (most recent call last):
File "C:\XXX\Thales-Remote-Python\ie_example.py", line 62, in <module>
zahnerZennium.setIESecondEdgePotential(10000)
File "C:\XXX\Thales-Remote-Python\ThalesRemote\ThalesRemoteScriptWrapper.py", line 648, in setIESecondEdgePotential
return self.setValue("IE_EckPot2", potential)
File "C:\XXX\Thales-Remote-Python\ThalesRemote\ThalesRemoteScriptWrapper.py", line 1026, in setValue
raise ThalesRemoteError(reply.rstrip("\r") + ThalesRemoteScriptWrapper.undefindedStandardErrorString)
ThalesRemoteError.ThalesRemoteError: ERROR;100;1
----Explanation----
In the last line you can see what kind of error has occurred:
ThalesRemoteError.ThalesRemoteError: ERROR;100;1
^ ^
| |
| Error number from the Remote2 manual https://doc.zahner.de/manuals/remote2.pdf
| You can see in the table in chapter 7 of the manual:
| 100 | ERROR_PARAMETER_OUT_OF_RANGE | Sent value too low/high
|
ThalesRemoteError shows that it is an error generated by the library due to a response from the Zenniums containing an error.
The first two lines of the traceback show the file and line number and the content of the line where the error occurred.
File "C:\XXX\Thales-Remote-Python\ie_example.py", line 62, in <module>
zahnerZennium.setIESecondEdgePotential(10000)
The error occurred in line 62 of the file ie_example.py with the statement zahnerZennium.setIESecondEdgePotential(10000).
This means that the value 10000, which should be set, is out of the allowed range.
"""
class ThalesRemoteError(Exception):
"""Thales Remote Exception Class
This exception is thrown when an error is reported in the remote protocol, for example,
when a parameter is out of range.
In the following document the errors are explained.
https://doc.zahner.de/manuals/remote2.pdf
"""
message: str
def __init__(self, message):
self.message = message
super().__init__(self.message)
class TermConnectionError(Exception):
"""Term Connection Exception Class
This exception is thrown when an error occurs with the term communication,
which has not yet been thrown by a socket exception.
After this error the connection must be completely rebuilt.
"""
message: str
def __init__(self, message: str):
self.message = message
super().__init__(self.message)