-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sentry spam errors #82
Fix sentry spam errors #82
Conversation
Improve catch error for is_concentrator_sx1302 func.
Change linter version
Add custom exception. Check and catch new exception.
a3ad28d
to
36b5a3a
Compare
pktfwd/utils.py
Outdated
@@ -73,9 +81,12 @@ def is_concentrator_sx1302(util_chip_id_filepath, spi_bus): | |||
return True | |||
# CalledProcessError raised if there is a non-zero exit code | |||
# https://docs.python.org/3/library/subprocess.html#using-the-subprocess-module | |||
except subprocess.CalledProcessError as e: | |||
LOGGER.warning(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to debug level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Level changed:
Line 81 in c953239
LOGGER.debug(e) |
pktfwd/utils.py
Outdated
@@ -207,10 +218,12 @@ def retry_start_concentrator(is_sx1302, spi_bus, | |||
# lora_pkt_fwd exited without error. Attempt to restart the process | |||
# by throwing an exception, which will trigger retry. | |||
elif lora_pkt_fwd_proc_returncode == 0: | |||
raise Exception("lora_pkt_fwd stopped without error.") | |||
raise LoraPacketForwarderStopException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename exception: LoraPacketForwarderStoppedWithoutError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed:
Line 217 in c953239
raise LoraPacketForwarderStoppedWithoutError( |
pktfwd/utils.py
Outdated
|
||
# lora_pkt_fwd exited with error. Restart the container by letting | ||
# the python application exit without error. | ||
else: | ||
LOGGER.error("lora_pkt_fwd stopped with code=%s." % | ||
lora_pkt_fwd_proc_returncode) | ||
raise LoraPacketForwarderStopWithStatusException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old code was correct. This is a real error, we need to fix the root cause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roolback
Lines 222 to 224 in c953239
else: | |
LOGGER.error("lora_pkt_fwd stopped with code=%s." % | |
lora_pkt_fwd_proc_returncode) |
Rollback changes on exit with an error.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -207,7 +214,8 @@ def retry_start_concentrator(is_sx1302, spi_bus, | |||
# lora_pkt_fwd exited without error. Attempt to restart the process | |||
# by throwing an exception, which will trigger retry. | |||
elif lora_pkt_fwd_proc_returncode == 0: | |||
raise Exception("lora_pkt_fwd stopped without error.") | |||
raise LoraPacketForwarderStoppedWithoutError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be LoraPacketForwarderStoppedWithError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is correct.
@@ -207,7 +214,8 @@ def retry_start_concentrator(is_sx1302, spi_bus, | |||
# lora_pkt_fwd exited without error. Attempt to restart the process | |||
# by throwing an exception, which will trigger retry. | |||
elif lora_pkt_fwd_proc_returncode == 0: | |||
raise Exception("lora_pkt_fwd stopped without error.") | |||
raise LoraPacketForwarderStoppedWithoutError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is correct.
Issue
Closes #79
Related #139
How
Add catching expected errors.
References
Change linter version: link