Skip to content

Commit 74d7ae6

Browse files
committed
added documentation for exceptions (getdns.error)
1 parent 65641ec commit 74d7ae6

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

doc/exceptions.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
:mod:`getdns` exceptions
2+
=============================
3+
4+
.. module:: getdns
5+
:synopsis: getdns exception description and explanation
6+
.. sectionauthor:: Melinda Shore <[email protected]>
7+
8+
9+
getdns exceptions
10+
-----------------
11+
12+
.. py:exception:: getdns.error
13+
14+
getdns will throw an exception, ``getdns.error``, under
15+
certain conditions. Those conditions include:
16+
17+
* a required parameter having a bad value
18+
* a badly-formed domain name in the query
19+
* a bad ``Context()`` object
20+
* a failed ``Context()`` update
21+
* an out-of-bounds error for a getdns data structure
22+
* requesting an extension that doesn't exist
23+
* requesting DNSSEC validation while using stub
24+
resolution
25+
26+
Please note that a successful return from a getdns method
27+
does `not` indicate that the query returned the records
28+
being requested, but rather that the query is formed
29+
correctly and has been submitted to the DNS. A getdns
30+
exception is typically the result of a coding error.
31+
32+
getdns will set the exception message to a diagnostic
33+
string, which may be examined for help in resolving the
34+
error.
35+
36+
Example
37+
-------
38+
39+
::
40+
41+
import getdns, sys
42+
43+
c = getdns.Context()
44+
try:
45+
results = c.address('www.example.com', foo='bar')
46+
except getdns.error, e:
47+
print(str(e))
48+
sys.exit(1)
49+
50+
51+
This will result in "A required parameter had an invalid
52+
value" being printed to the screen.

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Contents:
191191

192192
functions
193193
response
194-
194+
exceptions
195195

196196

197197
Indices and tables

0 commit comments

Comments
 (0)