steamclock / netable

A Swift library for encapsulating network APIs using Codable in a type-oriented way.
MIT License
99 stars 3 forks source link

Redacted log destination redactable unwraps don't currently work. #70

Closed brendanlensink closed 3 years ago

brendanlensink commented 3 years ago

Right now, when we're logging objects that conform to redactable we're doing this unwrap:

   case .requestSuccess(_, _, let statusCode, _, let finalizedResult):
            if let result = finalizedResult as? Redacted {
                clog.info("Request completed with status code \(statusCode)", result)
            } else {
                clog.info("Request completed with status code \(statusCode). Finalized result redacted.")
            }

The problem is that finalized result is actually Result<FinalResource, NetableError> and so this unwrap always fails. We need to unwrap the result before we do this.