         throw DeserializationError.missingSecret
     }
     guard let generator = Generator(factor: factor, secret: secret, algorithm: algorithm, digits: digits) else {
-        return nil
+        // TODO: Convert Generator's failable initializer to a throwable initializer, and rethrow its errors.
+        throw DeserializationError.invalidGenerator
     }
 
     // Skip the leading "/"

    case invalidSecret(String)
    case invalidAlgorithm(String)
    case invalidDigits(String)
}

private let defaultAlgorithm: Generator.Algorithm = .sha1

    /// Attempts to initialize a token represented by the give URL.
    public init?(url: URL, secret: Data? = nil) {
        do {
            self = try token(from: url, secret: secret)
        } catch {
            return nil
        }
