Swift Result type with exception mechanism

I have an app that is already designed. General idea is rebuild error handling system. Current implementation is build on async callbacks ( like completionBlock: (Result<Data, Error>) -> Void ).
Problem: if end user (programmer) doesn't handle error case, nothing happens and еrror is not being logged.
Question: is possible some how throw exception of some sort of it, if error was not handled ?

Hey Anton,

It depends on what exactly you mean by "doesn't handle the error case".

Fundamentally, Result forces you to consider the error case in at least some way, because you can't get at the Success without discriminating .success from .failure. Could you show us some example snippets where the user got a Result, but didn't handle the error case?

You could use something else like:

struct MyLoggedError<Value, ErrorType: Error> {
  private let resultValue: Result<Value, ErrorType>

  func result() -> Result<Value, ErrorType> {
    switch result {
    case .success: 
    case .failure(let error):
    return result

This might mean that the error gets logged multiple times from a result and you might need to build in some other functionalities to map/transform this type, but you could leave those as non-public to end users