 
            
            
            
            
                5 Jun
                
                    2017
                
            
            
                5 Jun
                
                '17
                
            
            
            
        
    
                4:46 p.m.
            
        Vicente J. Botet Escriba wrote:
Oh, in this case it is clear that result<T> is not enough. We need expected<T, filesystem::error>
where filesystem:error contains the error_code and the path.
I don't find this particularly appealing, because the whole point of std::error_code was to avoid the need for each library to define separate error classes. expected<T, filesystem::error> will work, I'd just not be willing to recommend it as a general solution. Something like Niall's new outcome<T> that stores both an error_code and an exception seems better, because you can use a single common return type in all libraries.