Open c4talyst opened 1 month ago
My wordaround for now:
try:
result = push_service.notify(
fcm_token="cheeseburgers",
notification_title=title,
notification_body=message_body,
)
except InvalidDataError as e:
error_message = str(e)
# Remove newlines and extra spaces
formatted_error_message = ' '.join(error_message.split())
raise InvalidDataError(formatted_error_message) from None
Summary
The InvalidDataError Exception, when logged, outputs multi-line text (which happens to also be JSON) which is not properly handled by things like Google Cloud Log Explorer. This makes filtering logs difficult.
https://github.com/olucurious/PyFCM/blob/15cdc602c182c6a0df59e630b359321b9246a2e3/pyfcm/baseapi.py#L212
Resolution
response.text
.Steps to reproduce
Using
pyfcm==2.0.4