<commit_before>
// Copyright 2014 Toggl Desktop developers.

#include "../src/error.h"

#include <string>

#include "./const.h"

namespace toggl {

bool IsNetworkingError(const error err) {
    std::string value(err);
    if (value.find(kCannotConnectError) != std::string::npos) {
        return true;
    }
    if (value.find("Cannot establish proxy connection") != std::string::npos) {
        return true;
    }
    if (value.find("certificate verify failed") != std::string::npos) {
        return true;
    }
    if (value.find("Proxy Authentication Required") != std::string::npos) {
        return true;
    }
    if (value.find("Cannot assign requested address") != std::string::npos) {
        return true;
    }
    if (value.find("Certificate validation error") != std::string::npos) {
        return true;
    }
    if (value.find("Unacceptable certificate from www.toggl.com")
            != std::string::npos) {
        return true;
    }
    if (value.find("Host not found") != std::string::npos) {
        return true;
    }
    if (value.find("Cannot upgrade to WebSocket connection")
            != std::string::npos) { // NOLINT
        return true;
    }
    if (value.find("No message received") != std::string::npos) {
        return true;
    }
    if (value.find("Connection refused") != std::string::npos) {
        return true;
    }
    if (value.find("Connection timed out") != std::string::npos) {
        return true;
    }
    if (value.find("connect timed out") != std::string::npos) {
        return true;
    }
    if (value.find("SSL connection unexpectedly closed") != std::string::npos) {
        return true;
    }
    if (value.find("Network is down") != std::string::npos) {
        return true;
    }
    if (value.find("Network is unreachable") != std::string::npos) {
        return true;
    }
    if (value.find("Host is down") != std::string::npos) {
        return true;
    }
    if (value.find("No route to host") != std::string::npos) {
        return true;
    }
    if ((value.find("I/O error: 1") != std::string::npos)
            && (value.find(":443") != std::string::npos)) {
        return true;
    }
    if (value.find("The request timed out") != std::string::npos) {
        return true;
    }
    if (value.find("Could not connect to the server") != std::string::npos) {
        return true;
    }
    if (value.find("Connection reset by peer") != std::string::npos) {
        return true;
    }
    if (value.find("The Internet connection appears to be offline")
            != std::string::npos) {
        return true;
    }
    if (value.find("Timeout") != std::string::npos) {
        return true;
    }
    if (value.find("SSL Exception") != std::string::npos) {
        return true;
    }
    if (value.find("An internal server error occurred.") != std::string::npos) {
        return true;
    }
    return false;
}

bool IsUserError(const error err) {
    if (noError == err) {
        return false;
    }
    std::string value(err);
    if (value.find(kPaymentRequiredError) != std::string::npos) {
        return true;
    }
    if (value.find(kBadRequestError) != std::string::npos) {
        return true;
    }
    if (value.find(kUnauthorizedError) != std::string::npos) {
        return true;
    }
    if (value.find("So short time entries, perhaps accidentally?")
            != std::string::npos) {
        return true;
    }
    if (value.find("Cannot write file") != std::string::npos) {
        return true;
    }
    if (value.find("is suspended") != std::string::npos) {
        return true;
    }
    if (value.find("Request to server failed with status code: 403")
            != std::string::npos) {
        return true;
    }
    if (value.find("This version of the app is not supported")
            != std::string::npos) {
        return true;
    }
    if (value.find("Stop time must be after start time")
            != std::string::npos) {
        return true;
    }
    if (value.find("Invalid e-mail or password") != std::string::npos) {
        return true;
    }<commit_msg>'Access to file denied' is user error (lib)<commit_after>
// Copyright 2014 Toggl Desktop developers.

#include "../src/error.h"

#include <string>

#include "./const.h"

namespace toggl {

bool IsNetworkingError(const error err) {
    std::string value(err);
    if (value.find(kCannotConnectError) != std::string::npos) {
        return true;
    }
    if (value.find("Cannot establish proxy connection") != std::string::npos) {
        return true;
    }
    if (value.find("certificate verify failed") != std::string::npos) {
        return true;
    }
    if (value.find("Proxy Authentication Required") != std::string::npos) {
        return true;
    }
    if (value.find("Cannot assign requested address") != std::string::npos) {
        return true;
    }
    if (value.find("Certificate validation error") != std::string::npos) {
        return true;
    }
    if (value.find("Unacceptable certificate from www.toggl.com")
            != std::string::npos) {
        return true;
    }
    if (value.find("Host not found") != std::string::npos) {
        return true;
    }
    if (value.find("Cannot upgrade to WebSocket connection")
            != std::string::npos) { // NOLINT
        return true;
    }
    if (value.find("No message received") != std::string::npos) {
        return true;
    }
    if (value.find("Connection refused") != std::string::npos) {
        return true;
    }
    if (value.find("Connection timed out") != std::string::npos) {
        return true;
    }
    if (value.find("connect timed out") != std::string::npos) {
        return true;
    }
    if (value.find("SSL connection unexpectedly closed") != std::string::npos) {
        return true;
    }
    if (value.find("Network is down") != std::string::npos) {
        return true;
    }
    if (value.find("Network is unreachable") != std::string::npos) {
        return true;
    }
    if (value.find("Host is down") != std::string::npos) {
        return true;
    }
    if (value.find("No route to host") != std::string::npos) {
        return true;
    }
    if ((value.find("I/O error: 1") != std::string::npos)
            && (value.find(":443") != std::string::npos)) {
        return true;
    }
    if (value.find("The request timed out") != std::string::npos) {
        return true;
    }
    if (value.find("Could not connect to the server") != std::string::npos) {
        return true;
    }
    if (value.find("Connection reset by peer") != std::string::npos) {
        return true;
    }
    if (value.find("The Internet connection appears to be offline")
            != std::string::npos) {
        return true;
    }
    if (value.find("Timeout") != std::string::npos) {
        return true;
    }
    if (value.find("SSL Exception") != std::string::npos) {
        return true;
    }
    if (value.find("An internal server error occurred.") != std::string::npos) {
        return true;
    }
    return false;
}

bool IsUserError(const error err) {
    if (noError == err) {
        return false;
    }
    std::string value(err);
    if (value.find(kPaymentRequiredError) != std::string::npos) {
        return true;
    }
    if (value.find("Access to file denied") != std::string::npos) {
        return true;
    }
    if (value.find(kBadRequestError) != std::string::npos) {
        return true;
    }
    if (value.find(kUnauthorizedError) != std::string::npos) {
        return true;
    }
    if (value.find("So short time entries, perhaps accidentally?")
            != std::string::npos) {
        return true;
    }
    if (value.find("Cannot write file") != std::string::npos) {
        return true;
    }
    if (value.find("is suspended") != std::string::npos) {
        return true;
    }
    if (value.find("Request to server failed with status code: 403")
            != std::string::npos) {
        return true;
    }
    if (value.find("This version of the app is not supported")
            != std::string::npos) {
        return true;
    }
    if (value.find("Stop time must be after start time")
            != std::string::npos) {
        return true;
    }
    if (value.find("Invalid e-mail or password") != std::string::npos) {
        return true;
    }
{'fraction_non_alphanumeric': 0.15870327809362525, 'fraction_numerical': 0.002661183016813838, 'mean_word_length': 2.422185430463576, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3042594', 'n_tokens_mistral': 2585, 'n_tokens_neox': 2550, 'n_words': 637}