-
Notifications
You must be signed in to change notification settings - Fork 0
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 omfg() in HandleErroredBillingBatch #295
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With the changes we made in [Better handle errors in Notifiers](#273) calls to `omfg()` should pass the error separately from any data to be included. Whilst working on the code we spotted an instance we'd overlooked when updating all our `omfg()` calls.
Plus sort a typo we spotted.
Cruikshanks
added a commit
that referenced
this pull request
Jul 6, 2023
When working on [Implement SROC invoice reissuing](#256) we had to deal with a situation where we wanted to throw an error that contained details of the records in the current context. But we were faced with the issue that we knew the error would eventually find it's way to our notifiers. If we include the details in the error message we break Errbit's ability to group instances of an error. But the standard [Error constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) doesn't support passing in additional values. To avoid making things complicated for ourselves we did this ```javascript const error = new Error('Charging Module reissue request failed') error.billingBatchExternalId = billingBatchExternalId error.invoiceExternalId = invoiceExternalId throw error ``` We know both Pino our logger will include these extra properties in its output and Errbit can still do its stuff. Then when working on [Fix omfg() in HandleErroredBillingBatch](#295) we did a review of all our `omfg()` calls. This led us to find this in `InitiateBillingBatchService` ```javascript if (liveBillRunExists) { throw Error(`Batch already live for region ${regionId}`) } ``` This is an example of an error message that will block Errbit from grouping these errors. We could fix this by doing what we did in `ReissueInvoiceService`. But it's probably time to add our own custom error that allows us to do it properly. This change adds the error and applies it where applicable.
Jozzey
approved these changes
Jul 6, 2023
Cruikshanks
added a commit
that referenced
this pull request
Jul 6, 2023
When working on [Implement SROC invoice reissuing](#256) we had to deal with a situation where we wanted to throw an error that contained details of the records in the current context. But we were faced with the issue that we knew the error would eventually find its way to our notifiers. If we include the details in the error message we break Errbit's ability to group instances of an error. But the standard [Error constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) doesn't support passing in additional values. To avoid making things complicated for ourselves we did this ```javascript const error = new Error('Charging Module reissue request failed') error.billingBatchExternalId = billingBatchExternalId error.invoiceExternalId = invoiceExternalId throw error ``` We know both Pino our logger will include these extra properties in its output and Errbit can still do its stuff. Then when working on [Fix omfg() in HandleErroredBillingBatch](#295) we did a review of all our `omfg()` calls. This led us to find this in `InitiateBillingBatchService` ```javascript if (liveBillRunExists) { throw Error(`Batch already live for region ${regionId}`) } ``` This is an example of an error message that will block Errbit from grouping these errors. We could fix this by doing what we did in `ReissueInvoiceService`. But it's probably time to add our own custom error that allows us to do it properly. This change adds the error and applies it where applicable.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the changes we made in Better handle errors in Notifiers calls to
omfg()
should pass the error separately from any data to be included.Whilst working on the code we spotted an instance we'd overlooked when updating all our
omfg()
calls.