scripted-diff: Replace error() with LogError()

This fixes the log output when -logsourcelocations is used.

Also, instead of 'ERROR:', the log will now say '[error]', like other
errors logged with LogError.

-BEGIN VERIFY SCRIPT-
 sed -i --regexp-extended 's!  error\("([^"]+)"!  LogError("\1\\n"!g' $( git grep -l '  error(' ./src/ )
-END VERIFY SCRIPT-
This commit is contained in:
MarcoFalke
2024-01-11 19:43:27 +01:00
parent fa808fb749
commit fad0335517
13 changed files with 97 additions and 97 deletions

View File

@@ -338,7 +338,7 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
IntrRecvError recvr;
LogPrint(BCLog::NET, "SOCKS5 connecting %s\n", strDest);
if (strDest.size() > 255) {
error("Hostname too long");
LogError("Hostname too long\n");
return false;
}
// Construct the version identifier/method selection message
@@ -359,7 +359,7 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
return false;
}
if (pchRet1[0] != SOCKSVersion::SOCKS5) {
error("Proxy failed to initialize");
LogError("Proxy failed to initialize\n");
return false;
}
if (pchRet1[1] == SOCKS5Method::USER_PASS && auth) {
@@ -367,7 +367,7 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
std::vector<uint8_t> vAuth;
vAuth.push_back(0x01); // Current (and only) version of user/pass subnegotiation
if (auth->username.size() > 255 || auth->password.size() > 255) {
error("Proxy username or password too long");
LogError("Proxy username or password too long\n");
return false;
}
vAuth.push_back(auth->username.size());
@@ -378,17 +378,17 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
LogPrint(BCLog::PROXY, "SOCKS5 sending proxy authentication %s:%s\n", auth->username, auth->password);
uint8_t pchRetA[2];
if (InterruptibleRecv(pchRetA, 2, g_socks5_recv_timeout, sock) != IntrRecvError::OK) {
error("Error reading proxy authentication response");
LogError("Error reading proxy authentication response\n");
return false;
}
if (pchRetA[0] != 0x01 || pchRetA[1] != 0x00) {
error("Proxy authentication unsuccessful");
LogError("Proxy authentication unsuccessful\n");
return false;
}
} else if (pchRet1[1] == SOCKS5Method::NOAUTH) {
// Perform no authentication
} else {
error("Proxy requested wrong authentication method %02x", pchRet1[1]);
LogError("Proxy requested wrong authentication method %02x\n", pchRet1[1]);
return false;
}
std::vector<uint8_t> vSocks5;
@@ -409,12 +409,12 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
* error message. */
return false;
} else {
error("Error while reading proxy response");
LogError("Error while reading proxy response\n");
return false;
}
}
if (pchRet2[0] != SOCKSVersion::SOCKS5) {
error("Proxy failed to accept request");
LogError("Proxy failed to accept request\n");
return false;
}
if (pchRet2[1] != SOCKS5Reply::SUCCEEDED) {
@@ -423,7 +423,7 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
return false;
}
if (pchRet2[2] != 0x00) { // Reserved field must be 0
error("Error: malformed proxy response");
LogError("Error: malformed proxy response\n");
return false;
}
uint8_t pchRet3[256];
@@ -433,7 +433,7 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
case SOCKS5Atyp::DOMAINNAME: {
recvr = InterruptibleRecv(pchRet3, 1, g_socks5_recv_timeout, sock);
if (recvr != IntrRecvError::OK) {
error("Error reading from proxy");
LogError("Error reading from proxy\n");
return false;
}
int nRecv = pchRet3[0];
@@ -441,22 +441,22 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
break;
}
default: {
error("Error: malformed proxy response");
LogError("Error: malformed proxy response\n");
return false;
}
}
if (recvr != IntrRecvError::OK) {
error("Error reading from proxy");
LogError("Error reading from proxy\n");
return false;
}
if (InterruptibleRecv(pchRet3, 2, g_socks5_recv_timeout, sock) != IntrRecvError::OK) {
error("Error reading from proxy");
LogError("Error reading from proxy\n");
return false;
}
LogPrint(BCLog::NET, "SOCKS5 connected %s\n", strDest);
return true;
} catch (const std::runtime_error& e) {
error("Error during SOCKS5 proxy handshake: %s", e.what());
LogError("Error during SOCKS5 proxy handshake: %s\n", e.what());
return false;
}
}