Say I have some program that during initialization reads in two different files,
Data. The kind of error here could be
NotFound, etc. Is there some idiomatic way of implementing
From such that the
? operator could, for example, return
OpenConfigFilePermissionDenied for an error operning the config file or
OpenDataFileNotFound for the data file depending on the context of the error, ie where the error occurred.
The implementation of
std::io::Error is interesting in this regard. It has
Custom variants, but it still can't use any contextual information when converting to another error.
Is there some common pattern for this situation?