Add a stub for errors coming from Android
These errors are related to VPN connection errors
This commit is contained in:
parent
375825125f
commit
eafac491d8
4 changed files with 11 additions and 3 deletions
|
|
@ -15,8 +15,6 @@ import android.os.Messenger
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.MainThread
|
import androidx.annotation.MainThread
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import java.io.FileNotFoundException
|
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import kotlin.LazyThreadSafetyMode.NONE
|
import kotlin.LazyThreadSafetyMode.NONE
|
||||||
import kotlinx.coroutines.CompletableDeferred
|
import kotlinx.coroutines.CompletableDeferred
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,10 @@ enum ErrorCode
|
||||||
CloakExecutableCrashed,
|
CloakExecutableCrashed,
|
||||||
|
|
||||||
// import and install errors
|
// import and install errors
|
||||||
ImportInvalidConfigError
|
ImportInvalidConfigError,
|
||||||
|
|
||||||
|
// Android errors
|
||||||
|
AndroidError
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace amnezia
|
} // namespace amnezia
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ QString errorString(ErrorCode code){
|
||||||
|
|
||||||
case (ImportInvalidConfigError): return QObject::tr("The config does not contain any containers and credentials for connecting to the server");
|
case (ImportInvalidConfigError): return QObject::tr("The config does not contain any containers and credentials for connecting to the server");
|
||||||
|
|
||||||
|
// Android errors
|
||||||
|
case (AndroidError): return QObject::tr("VPN connection error");
|
||||||
|
|
||||||
case(InternalError):
|
case(InternalError):
|
||||||
default:
|
default:
|
||||||
return QObject::tr("Internal error");
|
return QObject::tr("Internal error");
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,10 @@ void VpnConnection::flushDns()
|
||||||
|
|
||||||
ErrorCode VpnConnection::lastError() const
|
ErrorCode VpnConnection::lastError() const
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
return ErrorCode::AndroidError;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!m_vpnProtocol.data()) {
|
if (!m_vpnProtocol.data()) {
|
||||||
return ErrorCode::InternalError;
|
return ErrorCode::InternalError;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue