Skip to content

Commit 4d5d2c6

Browse files
committed
documenting error handling
1 parent 35259d9 commit 4d5d2c6

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,22 @@ g.help('address')
145145
g.help('input')
146146
```
147147

148+
### Error Handling
149+
150+
python-geosupport will raise a `GeosupportError` when Geosupport returns an
151+
error code. Sometimes there is more information returned, in which case the
152+
exception will have a `result` dictionary.
153+
154+
```python
155+
from geosupport import GeosupportError
156+
157+
try:
158+
g.get_street_code(borough='MN', street='Wort Street')
159+
except GeosupportError as e:
160+
print(e) # 'WORT STREET' NOT RECOGNIZED. THERE ARE 010 SIMILAR NAMES.
161+
print(e.result['List of Street Names']) # List of suggested alternate names
162+
```
163+
148164
## Development
149165

150166
### Running tests

geosupport/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .geosupport import Geosupport
1+
from .geosupport import Geosupport, GeosupportError

0 commit comments

Comments
 (0)