The original implementation of DiskCacheError can be simplified and still achieve it's original purpose.
Solution:
During token refresh we eventually write to the disk cache. Sometimes this process fails due to filesystem errors.
We dont need to care about the actual file system error, but only that the error came during a DiskCache operation (i.e when it attempts to save the token to disk)
So instead, at the root of where the disk cache errors ocurr, we will wrap caught errors in a DiskCacheError.
This adds context to the error and allows anything upstream to specifically check for that context, instead of needing to parse the error to see if it was filesystem related.
Additionally not all file system errors were guaranteed to come from the disk cache, so this change allows us to target the right errors.
Problem:
The original implementation of DiskCacheError can be simplified and still achieve it's original purpose.
Solution:
During token refresh we eventually write to the disk cache. Sometimes this process fails due to filesystem errors.
We dont need to care about the actual file system error, but only that the error came during a DiskCache operation (i.e when it attempts to save the token to disk)
So instead, at the root of where the disk cache errors ocurr, we will wrap caught errors in a DiskCacheError. This adds context to the error and allows anything upstream to specifically check for that context, instead of needing to parse the error to see if it was filesystem related.
Additionally not all file system errors were guaranteed to come from the disk cache, so this change allows us to target the right errors.
Signed-off-by: Nikolas Komonen nkomonen@amazon.com
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.