<commit_before>//
// APIError.swift
//
// Generated by SwagGen
// https://github.com/yonaskolb/SwagGen
//

import JSONUtilities

public enum APIError: Error {
    case unexpectedStatusCode(statusCode: Int, data: Data)
    case jsonDeserializationError(JSONUtilsError)
    case decodingError(DecodingError)
    case invalidBaseURL(String)
    case authorizationError(AuthorizationError)
    case networkError(Error)
    case unknownError(Error)
}

extension APIError: CustomStringConvertible {

    public var description:String {
        switch self {
        case .unexpectedStatusCode(let statusCode, _): return "Unexpected status code \(statusCode)"
        case .jsonDeserializationError(let error): return "\(error)"
        case .decodingError(let error): return error.description
        case .invalidBaseURL(let url): return "Invalid base URL \"\(url)\""
        case .authorizationError(let error): return "Failed to authorize: \(error.reason)"
        case .networkError(let error): return "Network error: \(error.localizedDescription)"
        case .unknownError(let error): return "Unknown error \(error.localizedDescription)"
        }
    }
}<commit_msg>Swift template: added APIError.name<commit_after>//
// APIError.swift
//
// Generated by SwagGen
// https://github.com/yonaskolb/SwagGen
//

import JSONUtilities

public enum APIError: Error {
    case unexpectedStatusCode(statusCode: Int, data: Data)
    case jsonDeserializationError(JSONUtilsError)
    case decodingError(DecodingError)
    case invalidBaseURL(String)
    case authorizationError(AuthorizationError)
    case networkError(Error)
    case unknownError(Error)

    public var name:String {
        switch self {
        case .unexpectedStatusCode: return "Unexpected status code"
        case .jsonDeserializationError: return "JSON deserialiation error"
        case .decodingError: return "Decoding error"
        case .invalidBaseURL: return "Invalid base URL"
        case .authorizationError: return "Failed to authorize"
        case .networkError: return "Network error"
        case .unknownError: return "Unknown error"
        }
    }
}

extension APIError: CustomStringConvertible {

    public var description:String {
        switch self {
        case .unexpectedStatusCode(let statusCode, _): return "\(name): \(statusCode)"
        case .jsonDeserializationError(let error): return "\(name): \(error)"
        case .decodingError(let error): return "\(name): \(error.description)"
        case .invalidBaseURL(let url): return "\(name): \(url)"
        case .authorizationError(let error): return "\(name): \(error.reason)"
        case .networkError(let error): return "\(name): \(error.localizedDescription)"
        case .unknownError(let error): return "\(name): \(error.localizedDescription)"
        }
    }
}
{'fraction_non_alphanumeric': 0.10649627263045794, 'fraction_numerical': 0.0, 'mean_word_length': 3.437795275590551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5692215', 'n_tokens_mistral': 757, 'n_tokens_neox': 747, 'n_words': 211}