     ///
     /// - tokenExpired: request received a 401 from a backend
     /// - badRequest: generic error for responses
-    /// - unknownReason: a request that could not validate a status code
+    /// - internalServerError: a 500 request
+    /// - badStatusCode: a request that could not validate a status code
+    /// - persistanceFailure: any issues related to our data layer
     public enum ResponseFailureReason {
         
         case tokenExpired(code: Int)
-        case badRequest(code: Int)
+        case badRequest(error: Error)
         case internalServerError
         case badStatusCode
         case persistanceFailure(code: Int)

    
    case responseValidationFailed(reason: ResponseFailureReason)
    case persistanceValidationFailed(reason: PersistanceFailureReason)
}

extension MSError.ResponseFailureReason {
    var responseCode: Int {
        switch self {
        case .tokenExpired(let code),.badRequest(let code):
            return code
        case .internalServerError:
            return 500
        default:
            return 0
        }
    }
    var hasTokenExpired: Bool {
        switch self {
        case .tokenExpired( _):

            return reason.responseCode
        default:
            return 0
        }
    }
    
    /// The `Error` returned by a system framework associated with a `.responseValidationFailed`
    public var underlyingError: Error? {
        switch self {
        case .responseValidationFailed(let reason):
            return reason.underlyingError
        default:
            return nil
        }
    }
    
