I suggest a WithFields() method that lets you add arbitrary data to your error object, that can later be fetched (even if it was added to a nested error). We use this with alternating key-values for adding useful information to our errors for logging them later.
I suggest a WithFields() method that lets you add arbitrary data to your error object, that can later be fetched (even if it was added to a nested error). We use this with alternating key-values for adding useful information to our errors for logging them later.
Usage:
Implementation: