<commit_before>//
//  TraktError.swift
//  TraktKit
//
//  Created by <NAME> on 06.05.17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

extension Trakt {
    public enum Error: Swift.Error {
        /// Authorization information are missing
        case missingAuthorization

        /// Authorization inforamtion are invalid
        case invalidAuthorization

        /// Unknown server response
        case unknownServerResponse(Swift.Error?)

        /// Unknown http status code
        case unknownHttpStatusCode(HTTPURLResponse, Swift.Error?)

        /// Bad http status code
        case badHttpStatusCode(StatusCode, Swift.Error?)

        /// Missing response data
        case missingResponseData(HTTPURLResponse, Swift.Error?)

        /// JSON decoding error
        case jsonDecodingError(Swift.Error)
    }
}

extension Trakt.Error: CustomStringConvertible {
    public var description: String {
        switch self {
        case .missingAuthorization:
            return "Unauthorized"
        case .invalidAuthorization:
            return "Invalid Authorization"
        case .unknownServerResponse:
            return "Unknown Server Response"
        case .unknownHttpStatusCode:
            return "Invalid Server Response"
        case .badHttpStatusCode(let statusCode, _):
            return statusCode.description
        case .missingResponseData:
            return "Invalid Server Response"
        case .jsonDecodingError:
            return "Invalid Server Response"
        }
    }
}

extension Trakt.Error: CustomDebugStringConvertible {
    public var debugDescription: String {<commit_msg>returns error.description as localizedDescription<commit_after>//
//  TraktError.swift
//  TraktKit
//
//  Created by <NAME> on 06.05.17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

extension Trakt {
    public enum Error: Swift.Error {
        /// Authorization information are missing
        case missingAuthorization

        /// Authorization inforamtion are invalid
        case invalidAuthorization

        /// Unknown server response
        case unknownServerResponse(Swift.Error?)

        /// Unknown http status code
        case unknownHttpStatusCode(HTTPURLResponse, Swift.Error?)

        /// Bad http status code
        case badHttpStatusCode(StatusCode, Swift.Error?)

        /// Missing response data
        case missingResponseData(HTTPURLResponse, Swift.Error?)

        /// JSON decoding error
        case jsonDecodingError(Swift.Error)

        public var localizedDescription: String {
            return description
        }
    }
}

extension Trakt.Error: CustomStringConvertible {
    public var description: String {
        switch self {
        case .missingAuthorization:
            return "Unauthorized"
        case .invalidAuthorization:
            return "Invalid Authorization"
        case .unknownServerResponse:
            return "Unknown Server Response"
        case .unknownHttpStatusCode:
            return "Invalid Server Response"
        case .badHttpStatusCode(let statusCode, _):
            return statusCode.description
        case .missingResponseData:
            return "Invalid Server Response"
        case .jsonDecodingError:
            return "Invalid Server Response"
        }
    }
}

extension Trakt.Error: CustomDebugStringConvertible {
    public var debugDescription: String {
{'fraction_non_alphanumeric': 0.07167832167832168, 'fraction_numerical': 0.005827505827505828, 'mean_word_length': 2.275763358778626, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '5880190', 'n_tokens_mistral': 834, 'n_tokens_neox': 798, 'n_words': 247}