Skip to content
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

Chore: enrich sentry debugging #302

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Chore: enrich sentry debugging #302

wants to merge 2 commits into from

Conversation

janz93
Copy link
Contributor

@janz93 janz93 commented Jan 21, 2025

What changes are introduced?

upload invalid import files to sentry

Why are these changes introduced?

Have invalid import files in sentry next to the exception data for better error debugging

How are these changes made?

use sentry add_attachment feature

How was it tested? (optional)

remove this section, when you don't add further information

Some code, especially infrastructure code (say HELM or Kubernetes yaml files) are harder to test. So it’s important to let the reviewer know how you tested them in case you can’t check in tests. Alternatively, you can explain to the reviewer how to test it locally if necessary. Showing the results of tests you’ve run in this section if none are visible in the diff is also very helpful.

  • Specs
  • Locally
  • Staging

store invalid import files for later debugging
@@ -38,6 +38,7 @@ def fetch_for_account(account)

vmk_data = account.transport_client.VMK(safe_from.to_s(:db), safe_to.to_s(:db))
return unless vmk_data
vmk_data = vmk_data.encode(vmk_data.encoding, universal_newline: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems kinda weird updating the variable itself instead of having a decoded_vmk_data or something similar. How did this work before? Does it not need to be encoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes this can be named something else.
In short this ensures we have universal newlines and not some windows newlines as those create problems in the cmxl parser.

Any ideas for a name 😅

Copy link
Member

@bonflintstone bonflintstone Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah because vmk_data is just a string? Maybe just something like

Suggested change
vmk_data = vmk_data.encode(vmk_data.encoding, universal_newline: true)
vmk_data = account
.transport_client.VMK(safe_from.to_s(:db), safe_to.to_s(:db))
&.encode(vmk_data.encoding, universal_newline: true) # converting windows newlines
return unless vmk_data

Comment on lines 39 to +41
vmk_data = account.transport_client.VMK(safe_from.to_s(:db), safe_to.to_s(:db))
return unless vmk_data
vmk_data = vmk_data.encode(vmk_data.encoding, universal_newline: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vmk_data = account.transport_client.VMK(safe_from.to_s(:db), safe_to.to_s(:db))
return unless vmk_data
vmk_data = vmk_data.encode(vmk_data.encoding, universal_newline: true)
vmk_data = account
.transport_client.VMK(safe_from.to_s(:db), safe_to.to_s(:db))
&.then { it.encode(it.encoding, universal_newline: true) }
return unless vmk_data

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly you can also just leave it as you did but add a comment. I thought it was encoding some bank data structures or something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants