Skip to content

Commit 7a79a53

Browse files
committed
update how to get error message
1 parent 4961400 commit 7a79a53

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

documents/FAQ.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*__Jump To:__*
44
* [Where should I start](#where-should-i-start)
55
* [How do I enable logging](#how-do-i-enable-logging)
6+
* [What does the AwsCrtError mean](#what-does-the-awscrterror-mean)
67
* [Installation Issues](#installation-issues)
78
* [I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP](#i-keep-getting-aws_error_mqtt_unexpected_hangup)
89
* [I am experiencing deadlocks](#i-am-experiencing-deadlocks)
@@ -26,6 +27,26 @@ io.init_logging(io.LogLevel.Error, 'stderr')
2627
```
2728
You can also enable [CloudWatch logging](https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html) for IoT which will provide you with additional information that is not available on the client side sdk.
2829

30+
### What does the AwsCrtError mean?
31+
32+
When you encounter an `AwsCrtError`, you can get error details using `str()` or `repr()`:
33+
34+
```python
35+
try:
36+
# Your AWS IoT code here
37+
pass
38+
except Exception as e:
39+
print(f"Error: {e}") # Using str()
40+
print(f"Error: {repr(e)}") # Using repr() for more details
41+
```
42+
43+
**Example output:**
44+
```
45+
# Assume we got error 1059, AWS_IO_DNS_INVALID_NAME
46+
Error: AWS_IO_DNS_INVALID_NAME: Host name was invalid for dns resolution."
47+
Error: AwsCrtError(name='AWS_IO_DNS_INVALID_NAME', message='Host name was invalid for dns resolution.', code=1059)
48+
```
49+
2950
### Installation Issues
3051

3152
`awsiotsdk` depends on [awscrt](https://github.com/awslabs/aws-crt-python), which makes use of C extensions. Precompiled wheels are downloaded when installing on major platforms (Mac, Windows, Linux, Raspberry Pi OS). If wheels are unavailable for your platform, your machine must compile some C libraries. For example:

0 commit comments

Comments
 (0)