Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3269978
D12403.id41399.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D12403.id41399.diff
View Options
diff --git a/native/account/fullscreen-siwe-panel.react.js b/native/account/fullscreen-siwe-panel.react.js
--- a/native/account/fullscreen-siwe-panel.react.js
+++ b/native/account/fullscreen-siwe-panel.react.js
@@ -107,10 +107,10 @@
);
} catch (e) {
const messageForException = getMessageForException(e);
- if (messageForException === 'nonce expired') {
+ if (messageForException === 'nonce_expired') {
onNonceExpired('login');
} else if (
- messageForException === 'Unsupported version' ||
+ messageForException === 'unsupported_version' ||
messageForException === 'client_version_unsupported'
) {
Alert.alert(
diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-panel.react.js
@@ -349,7 +349,7 @@
{ cancelable: false },
);
} else if (
- messageForException === 'Unsupported version' ||
+ messageForException === 'unsupported_version' ||
messageForException === 'client_version_unsupported'
) {
Alert.alert(
diff --git a/native/account/registration/existing-ethereum-account.react.js b/native/account/registration/existing-ethereum-account.react.js
--- a/native/account/registration/existing-ethereum-account.react.js
+++ b/native/account/registration/existing-ethereum-account.react.js
@@ -82,7 +82,7 @@
}
} catch (e) {
const messageForException = getMessageForException(e);
- if (messageForException === 'nonce expired') {
+ if (messageForException === 'nonce_expired') {
setCachedSelections(oldUserSelections => ({
...oldUserSelections,
ethereumAccount: undefined,
@@ -96,7 +96,7 @@
},
);
} else if (
- messageForException === 'Unsupported version' ||
+ messageForException === 'unsupported_version' ||
messageForException === 'client_version_unsupported'
) {
Alert.alert(
diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js
--- a/native/account/registration/registration-server-call.js
+++ b/native/account/registration/registration-server-call.js
@@ -133,7 +133,7 @@
[{ text: 'OK', onPress: onAlertAcknowledged }],
{ cancelable: !onAlertAcknowledged },
);
- } else if (messageForException === 'Unsupported version') {
+ } else if (messageForException === 'unsupported_version') {
Alert.alert(
appOutOfDateAlertDetails.title,
appOutOfDateAlertDetails.message,
@@ -277,9 +277,9 @@
});
} catch (e) {
const messageForException = getMessageForException(e);
- if (messageForException === 'nonce expired') {
+ if (messageForException === 'nonce_expired') {
onNonceExpired();
- } else if (messageForException === 'Unsupported version') {
+ } else if (messageForException === 'unsupported_version') {
Alert.alert(
appOutOfDateAlertDetails.title,
appOutOfDateAlertDetails.message,
diff --git a/native/qr-code/qr-code-screen.react.js b/native/qr-code/qr-code-screen.react.js
--- a/native/qr-code/qr-code-screen.react.js
+++ b/native/qr-code/qr-code-screen.react.js
@@ -75,7 +75,7 @@
const messageForException = getMessageForException(err);
if (
messageForException === 'client_version_unsupported' ||
- messageForException === 'Unsupported version'
+ messageForException === 'unsupported_version'
) {
Alert.alert(
appOutOfDateAlertDetails.title,
diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs
--- a/services/identity/src/client_service.rs
+++ b/services/identity/src/client_service.rs
@@ -549,11 +549,17 @@
.await
.map_err(handle_db_error)?
{
- None => return Err(tonic::Status::invalid_argument("invalid nonce")),
+ None => {
+ return Err(tonic::Status::invalid_argument(
+ tonic_status_messages::INVALID_NONCE,
+ ))
+ }
Some(nonce) if nonce.is_expired() => {
// we don't need to remove the nonce from the table here
// because the DynamoDB TTL will take care of it
- return Err(tonic::Status::aborted("nonce expired"));
+ return Err(tonic::Status::aborted(
+ tonic_status_messages::NONCE_EXPIRED,
+ ));
}
Some(_) => self
.client
@@ -1073,11 +1079,17 @@
.await
.map_err(handle_db_error)?
{
- None => return Err(tonic::Status::invalid_argument("invalid nonce")),
+ None => {
+ return Err(tonic::Status::invalid_argument(
+ tonic_status_messages::INVALID_NONCE,
+ ))
+ }
Some(nonce) if nonce.is_expired() => {
// we don't need to remove the nonce from the table here
// because the DynamoDB TTL will take care of it
- return Err(tonic::Status::aborted("nonce expired"));
+ return Err(tonic::Status::aborted(
+ tonic_status_messages::NONCE_EXPIRED,
+ ));
}
Some(nonce_data) => self
.client
diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs
--- a/services/identity/src/constants.rs
+++ b/services/identity/src/constants.rs
@@ -231,6 +231,8 @@
pub const WALLET_ADDRESS_TAKEN: &str = "wallet_address_taken";
pub const WALLET_ADDRESS_NOT_RESERVED: &str = "wallet_address_not_reserved";
pub const USER_NOT_FOUND: &str = "user_not_found";
+ pub const INVALID_NONCE: &str = "invalid_nonce";
+ pub const NONCE_EXPIRED: &str = "nonce_expired";
}
// Tunnelbroker
diff --git a/shared/grpc_clients/src/error.rs b/shared/grpc_clients/src/error.rs
--- a/shared/grpc_clients/src/error.rs
+++ b/shared/grpc_clients/src/error.rs
@@ -15,10 +15,10 @@
}
pub fn unsupported_version() -> Status {
- Status::unimplemented("Unsupported version")
+ Status::unimplemented("unsupported_version")
}
pub fn is_version_unsupported(status: &Status) -> bool {
status.code() == Code::Unimplemented
- && status.message() == "Unsupported version"
+ && status.message() == "unsupported_version"
}
diff --git a/web/account/qr-code-login.react.js b/web/account/qr-code-login.react.js
--- a/web/account/qr-code-login.react.js
+++ b/web/account/qr-code-login.react.js
@@ -98,7 +98,7 @@
const messageForException = getMessageForException(err);
if (
messageForException === 'client_version_unsupported' ||
- messageForException === 'Unsupported version'
+ messageForException === 'unsupported_version'
) {
pushModal(<VersionUnsupportedModal />);
} else {
diff --git a/web/account/siwe-login-form.react.js b/web/account/siwe-login-form.react.js
--- a/web/account/siwe-login-form.react.js
+++ b/web/account/siwe-login-form.react.js
@@ -178,7 +178,7 @@
setError('account_does_not_exist');
} else if (
messageForException === 'client_version_unsupported' ||
- messageForException === 'Unsupported version'
+ messageForException === 'unsupported_version'
) {
setError('client_version_unsupported');
}
diff --git a/web/account/traditional-login-form.react.js b/web/account/traditional-login-form.react.js
--- a/web/account/traditional-login-form.react.js
+++ b/web/account/traditional-login-form.react.js
@@ -134,7 +134,7 @@
setErrorMessage('incorrect username or password');
} else if (
messageForException === 'client_version_unsupported' ||
- messageForException === 'Unsupported version'
+ messageForException === 'unsupported_version'
) {
setErrorMessage(getShortVersionUnsupportedError());
} else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 4:17 AM (17 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2513131
Default Alt Text
D12403.id41399.diff (7 KB)
Attached To
Mode
D12403: [identity] convert and dedup more tonic status messages
Attached
Detach File
Event Timeline
Log In to Comment