Skip to content

Commit

Permalink
Bug fix for cases where a generic error msg was sent to user
Browse files Browse the repository at this point in the history
  • Loading branch information
joergschultzelutter committed Apr 2, 2021
1 parent 900b249 commit d9fd9fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
13 changes: 5 additions & 8 deletions src/aprs_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,18 @@ def mycallback(raw_aprs_packet: dict):
human_readable_message = response_parameters[
"human_readable_message"
]
output_message = []
# Dump the HRM to the user if we have one
if human_readable_message:
output_message = make_pretty_aprs_messages(
message_to_add=f"{human_readable_message}",
destination_list=output_message,
add_sep=False,
)
# If not, just dump the link to the instructions
else:
output_message.append(
"Sorry, did not understand your request. Have a look at my command"
)
output_message.append(
"syntax, see https://github.com/joergschultzelutter/mpad"
)
output_message = [
"Sorry, did not understand your request. Have a look at my command",
"syntax, see https://github.com/joergschultzelutter/mpad",
]
logger.info(
msg=f"Unable to process APRS packet {raw_aprs_packet}"
)
Expand Down
4 changes: 3 additions & 1 deletion src/input_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
errmsg_cannot_find_coords_for_user: str = "Cannot find coordinates for callsign"
errmsg_invalid_country: str = "Invalid country code (need ISO3166-a2)"
errmsg_invalid_state: str = "Invalid US state"
errmsg_invalid_command: str = "Unknown command. Syntax:https://github.com/joergschultzelutter/mpad"
errmsg_invalid_command: str = (
"Unknown command. See https://github.com/joergschultzelutter/mpad"
)
errmsg_no_satellite_specified: str = "No satellite specified"
errmsg_no_cwop_specified: str = "No cwop id specified"

Expand Down
13 changes: 5 additions & 8 deletions src/parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,21 @@ def testcall(message_text: str, from_callsign: str):
human_readable_message = response_parameters[
"human_readable_message"
]
output_message = []
# Dump the HRM to the user if we have one
if human_readable_message:
output_message = make_pretty_aprs_messages(
message_to_add=f"{human_readable_message}",
destination_list=output_message,
add_sep=False,
)
# If not, just dump the link to the instructions
else:
output_message.append(
"Sorry, did not understand your request. Have a look at my command"
)
output_message.append(
output_message = [
"Sorry, did not understand your request. Have a look at my command",
"syntax, see https://github.com/joergschultzelutter/mpad"
)
]
logger.info(output_message)
#logger.info(msg=pformat(response_parameters))


if __name__ == "__main__":
testcall(message_text="whereis vriendschap", from_callsign="ua3mlr-9")
testcall(message_text="fhadsjfhjdsahf", from_callsign="ua3mlr-9")

0 comments on commit d9fd9fd

Please sign in to comment.