     case kAlgorithmSHA512:
         return .sha512
     default:
-        throw DeserializationError.algorithm
+        throw DeserializationError.invalidAlgorithm(string)
     }
 }
 

        } else if string == kFactorTimerKey {
            let period = try queryDictionary[kQueryPeriodKey].map(parseTimerPeriod) ?? defaultPeriod
            return .timer(period: period)
        }
        throw DeserializationError.factor
    }

    let algorithm = try queryDictionary[kQueryAlgorithmKey].map(algorithmFromString) ?? defaultAlgorithm

}

internal enum DeserializationError: Swift.Error {
    case invalidFactor(String)
    case invalidCounterValue(String)
    case invalidTimerPeriod(String)
    case invalidSecret(String)
    case invalidAlgorithm(String)
    case invalidDigits(String)
}

private let defaultAlgorithm: Generator.Algorithm = .sha1
