Follow-up: Use common utility for handling purchase errors with default causes
Problem
During the implementation of handling errors in the purchase flow we ended up using a very similar implementation around the application to handle errors and adding a cause to it.
Relevant conversation: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/9917#note_1890183120
Proposal
Implement a util to apply around the application for setting defaultCause
if the cause
on the error is not known. Example here. At the same time we could do an actual copy of the error turning it into an actual error. This would avoid the Object.assign
approach we currently use that changes the passed object.
Edited by Michael Lunøe