mirror of
https://github.com/akuker/RASCSI.git
synced 2024-10-19 12:24:04 +00:00
Do not log unknown operations as an error for backward/foward compatibility
This commit is contained in:
parent
2be845e4aa
commit
12ea3b6721
@ -60,7 +60,13 @@ bool CommandContext::ReturnLocalizedError(LocalizationKey key, PbErrorCode error
|
||||
const string& arg2, const string& arg3) const
|
||||
{
|
||||
// For the logfile always use English
|
||||
// Do not log unknown operations as an error for backward/foward compatibility with old/new clients
|
||||
if (error_code == PbErrorCode::UNKNOWN_OPERATION) {
|
||||
spdlog::trace(localizer.Localize(key, "en", arg1, arg2, arg3));
|
||||
}
|
||||
else {
|
||||
spdlog::error(localizer.Localize(key, "en", arg1, arg2, arg3));
|
||||
}
|
||||
|
||||
return ReturnStatus(false, localizer.Localize(key, locale, arg1, arg2, arg3), error_code, false);
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ Localizer::Localizer()
|
||||
Add(LocalizationKey::ERROR_AUTHENTICATION, "es", "Fallo de autentificación");
|
||||
Add(LocalizationKey::ERROR_AUTHENTICATION, "zh", "认证失败");
|
||||
|
||||
Add(LocalizationKey::ERROR_OPERATION, "en", "Unknown operation");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "de", "Unbekannte Operation");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "sv", "Okänd operation");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "fr", "Opération inconnue");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "es", "Operación desconocida");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "zh", "未知操作");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "en", "Unknown operation: %1");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "de", "Unbekannte Operation: %1");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "sv", "Okänd operation: %1");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "fr", "Opération inconnue: %1");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "es", "Operación desconocida: %1");
|
||||
Add(LocalizationKey::ERROR_OPERATION, "zh", "未知操作: %1");
|
||||
|
||||
Add(LocalizationKey::ERROR_LOG_LEVEL, "en", "Invalid log level '%1'");
|
||||
Add(LocalizationKey::ERROR_LOG_LEVEL, "de", "Ungültiger Log-Level '%1'");
|
||||
|
@ -323,9 +323,9 @@ bool Piscsi::ExecuteCommand(const CommandContext& context)
|
||||
}
|
||||
|
||||
if (!PbOperation_IsValid(operation)) {
|
||||
spdlog::error("Received unknown command with operation opcode " + to_string(operation));
|
||||
spdlog::trace("Ignored unknown command with operation opcode " + to_string(operation));
|
||||
|
||||
return context.ReturnLocalizedError(LocalizationKey::ERROR_OPERATION, UNKNOWN_OPERATION);
|
||||
return context.ReturnLocalizedError(LocalizationKey::ERROR_OPERATION, UNKNOWN_OPERATION, to_string(operation));
|
||||
}
|
||||
|
||||
spdlog::trace("Received " + PbOperation_Name(operation) + " command");
|
||||
|
@ -79,7 +79,7 @@ bool PiscsiExecutor::ProcessDeviceCmd(const CommandContext& context, const PbDev
|
||||
break;
|
||||
|
||||
default:
|
||||
return context.ReturnLocalizedError(LocalizationKey::ERROR_OPERATION);
|
||||
return context.ReturnLocalizedError(LocalizationKey::ERROR_OPERATION, to_string(operation));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user