specified error codes

This commit is contained in:
vladimir.kuznetsov 2024-01-29 21:33:35 +07:00
parent 3240aa3cb3
commit e7040f7cc8
2 changed files with 47 additions and 47 deletions

View file

@ -25,70 +25,70 @@ namespace amnezia
enum ErrorCode { enum ErrorCode {
// General error codes // General error codes
NoError = 0, NoError = 0,
UnknownError = 1, UnknownError = 100,
InternalError = 2, InternalError = 101,
NotImplementedError = 3, NotImplementedError = 102,
// Server errors // Server errors
ServerCheckFailed = 4, ServerCheckFailed = 200,
ServerPortAlreadyAllocatedError = 5, ServerPortAlreadyAllocatedError = 201,
ServerContainerMissingError = 6, ServerContainerMissingError = 202,
ServerDockerFailedError = 7, ServerDockerFailedError = 203,
ServerCancelInstallation = 8, ServerCancelInstallation = 204,
ServerUserNotInSudo = 9, ServerUserNotInSudo = 205,
ServerPacketManagerError = 10, ServerPacketManagerError = 206,
// Ssh connection errors // Ssh connection errors
SshRequestDeniedError = 11, SshRequestDeniedError = 300,
SshInterruptedError = 12, SshInterruptedError = 301,
SshInternalError = 13, SshInternalError = 302,
SshPrivateKeyError = 14, SshPrivateKeyError = 303,
SshPrivateKeyFormatError = 15, SshPrivateKeyFormatError = 304,
SshTimeoutError = 16, SshTimeoutError = 305,
// Ssh sftp errors // Ssh sftp errors
SshSftpEofError = 17, SshSftpEofError = 400,
SshSftpNoSuchFileError = 18, SshSftpNoSuchFileError = 401,
SshSftpPermissionDeniedError = 19, SshSftpPermissionDeniedError = 402,
SshSftpFailureError = 20, SshSftpFailureError = 403,
SshSftpBadMessageError = 21, SshSftpBadMessageError = 404,
SshSftpNoConnectionError = 22, SshSftpNoConnectionError = 405,
SshSftpConnectionLostError = 23, SshSftpConnectionLostError = 406,
SshSftpOpUnsupportedError = 24, SshSftpOpUnsupportedError = 407,
SshSftpInvalidHandleError = 25, SshSftpInvalidHandleError = 408,
SshSftpNoSuchPathError = 26, SshSftpNoSuchPathError = 409,
SshSftpFileAlreadyExistsError = 27, SshSftpFileAlreadyExistsError = 410,
SshSftpWriteProtectError = 28, SshSftpWriteProtectError = 411,
SshSftpNoMediaError = 29, SshSftpNoMediaError = 412,
// Local errors // Local errors
OpenVpnConfigMissing = 30, OpenVpnConfigMissing = 500,
OpenVpnManagementServerError = 31, OpenVpnManagementServerError = 501,
ConfigMissing = 32, ConfigMissing = 502,
// Distro errors // Distro errors
OpenVpnExecutableMissing = 33, OpenVpnExecutableMissing = 600,
ShadowSocksExecutableMissing = 34, ShadowSocksExecutableMissing = 601,
CloakExecutableMissing = 35, CloakExecutableMissing = 602,
AmneziaServiceConnectionFailed = 36, AmneziaServiceConnectionFailed = 603,
ExecutableMissing = 37, ExecutableMissing = 604,
// VPN errors // VPN errors
OpenVpnAdaptersInUseError = 38, OpenVpnAdaptersInUseError = 700,
OpenVpnUnknownError = 39, OpenVpnUnknownError = 701,
OpenVpnTapAdapterError = 40, OpenVpnTapAdapterError = 702,
AddressPoolError = 41, AddressPoolError = 703,
// 3rd party utils errors // 3rd party utils errors
OpenSslFailed = 42, OpenSslFailed = 800,
ShadowSocksExecutableCrashed = 43, ShadowSocksExecutableCrashed = 801,
CloakExecutableCrashed = 44, CloakExecutableCrashed = 802,
// import and install errors // import and install errors
ImportInvalidConfigError = 45, ImportInvalidConfigError = 900,
// Android errors // Android errors
AndroidError = 46 AndroidError = 1000
}; };
} // namespace amnezia } // namespace amnezia

View file

@ -69,7 +69,7 @@ QString errorString(ErrorCode code) {
errorMessage = QObject::tr("Internal error"); errorMessage = QObject::tr("Internal error");
} }
return errorMessage + QObject::tr("; ErrorCode: %1").arg(code); return QObject::tr("ErrorCode: %1. ").arg(code) + errorMessage;
} }
QDebug operator<<(QDebug debug, const ErrorCode &e) QDebug operator<<(QDebug debug, const ErrorCode &e)