Skip to content

Commit 5cdb318

Browse files
committed
Error documentation revised
The error documentation outside the class has been made more detailed. This has now been done in the class so that the documentation also appears on the API documentation web page.
1 parent d4886bc commit 5cdb318

2 files changed

Lines changed: 48 additions & 38 deletions

File tree

thales_remote/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
____ __ __ __ __ _ __
33
/_ / ___ _/ / ___ ___ ___________ / /__ / /__/ /_____(_) /__
44
/ /_/ _ `/ _ \/ _ \/ -_) __/___/ -_) / -_) '_/ __/ __/ / '_/

thales_remote/error.py

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,59 @@
2424
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
"""
2626

27-
r"""
28-
The following is an example for troubleshooting when an exception is thrown.
29-
30-
----Example exception----
31-
Traceback (most recent call last):
32-
File "C:\XXX\Thales-Remote-Python\ie_example.py", line 62, in <module>
33-
zahnerZennium.setIESecondEdgePotential(10000)
34-
File "C:\XXX\Thales-Remote-Python\ThalesRemote\ThalesRemoteScriptWrapper.py", line 648, in setIESecondEdgePotential
35-
return self.setValue("IE_EckPot2", potential)
36-
File "C:\XXX\Thales-Remote-Python\ThalesRemote\ThalesRemoteScriptWrapper.py", line 1026, in setValue
37-
raise ThalesRemoteError(reply.rstrip("\r") + ThalesRemoteScriptWrapper.undefindedStandardErrorString)
38-
ThalesRemoteError.ThalesRemoteError: ERROR;100;1
39-
40-
----Explanation----
41-
42-
In the last line you can see what kind of error has occurred:
43-
44-
ThalesRemoteError.ThalesRemoteError: ERROR;100;1
45-
^ ^
46-
| |
47-
| Error number from the Remote2 manual https://doc.zahner.de/manuals/remote2.pdf
48-
| You can see in the table in chapter 7 of the manual:
49-
| 100 | ERROR_PARAMETER_OUT_OF_RANGE | Sent value too low/high
50-
|
51-
ThalesRemoteError shows that it is an error generated by the library due to a response from the Zenniums containing an error.
52-
53-
The first two lines of the traceback show the file and line number and the content of the line where the error occurred.
54-
55-
File "C:\XXX\Thales-Remote-Python\ie_example.py", line 62, in <module>
56-
zahnerZennium.setIESecondEdgePotential(10000)
57-
58-
The error occurred in line 62 of the file ie_example.py with the statement zahnerZennium.setIESecondEdgePotential(10000).
59-
This means that the value 10000, which should be set, is out of the allowed range.
60-
"""
61-
6227

6328
class ThalesRemoteError(Exception):
6429
r"""Thales Remote Exception Class
6530
6631
This exception is thrown when an error is reported in the remote protocol, for example,
6732
when a parameter is out of range.
68-
In the following document the errors are explained.
69-
https://doc.zahner.de/manuals/remote2.pdf
33+
34+
The error numbers can be found in the Remote2 manual in chapter 6 from page 37:
35+
36+
* Link without line number:
37+
* https://doc.zahner.de/manuals/remote2.pdf
38+
* Link with line number (may not work with every browser/pdf reader):
39+
* https://doc.zahner.de/manuals/remote2.pdf#page=37
40+
41+
The following is an example for troubleshooting when an exception is thrown.
42+
43+
**Example exception**
44+
45+
.. code-block:: bash
46+
47+
Traceback (most recent call last):
48+
File "C:\XXX\Thales-Remote-Python\ie_example.py", line 62, in <module>
49+
zahnerZennium.setIESecondEdgePotential(10000)
50+
File "C:\XXX\Thales-Remote-Python\ThalesRemote\ThalesRemoteScriptWrapper.py", line 648, in setIESecondEdgePotential
51+
return self.setValue("IE_EckPot2", potential)
52+
File "C:\XXX\Thales-Remote-Python\ThalesRemote\ThalesRemoteScriptWrapper.py", line 1026, in setValue
53+
raise ThalesRemoteError(reply.rstrip("\r") + ThalesRemoteScriptWrapper.undefindedStandardErrorString)
54+
ThalesRemoteError.ThalesRemoteError: ERROR;100;1
55+
56+
**Explanation**
57+
58+
In the last line you can read what kind of error has occurred:
59+
60+
.. code-block:: bash
61+
62+
ThalesRemoteError.ThalesRemoteError: ERROR;100;1
63+
^ ^
64+
| |
65+
| Error number from the Remote2 manual https://doc.zahner.de/manuals/remote2.pdf
66+
| You can read in the table in chapter 6 of the manual:
67+
| 100 | ERROR_PARAMETER_OUT_OF_RANGE | Sent value too low/high
68+
|
69+
ThalesRemoteError shows that it is an error generated by the library due to a response from the Zenniums containing an error.
70+
71+
The first two lines of the traceback show the file and line number and the content of the line where the error occurred.
72+
73+
.. code-block:: bash
74+
75+
File "C:\XXX\Thales-Remote-Python\ie_example.py", line 62, in <module>
76+
zahnerZennium.setIESecondEdgePotential(10000)
77+
78+
The error occurred in line **62** of the file **ie_example.py** with the statement ``zahnerZennium.setIESecondEdgePotential(10000)``.
79+
This means that the value 10000, which should be set, is out of the allowed range.
7080
"""
7181

7282
message: str

0 commit comments

Comments
 (0)