Split of some known error cases from `fxa-client-other-error`
NoExistingAuthFlow can happen when users manually navigate through the oauth flow URLs. Just count the errors in Glean rather than report them to Sentry. Use a separate label for the errors, and reserve `fxa_other` for unexpected errors. Handle OriginMismatch the same, which can happen when trying to pair two firefox instances that are configured to use different servers. BackoffError was similar, but I kept the sentry reporting for this one, since it seems useful to see the reason for backoff errors. Going through the current list of backoff errors lead me to open #5918
This commit is contained in:
Родитель
56bcdac661
Коммит
acbb1bef48
|
@ -41,6 +41,8 @@ fxa_client:
|
|||
labels:
|
||||
- network
|
||||
- authentication
|
||||
- no_existing_auth_flow
|
||||
- origin_mismatch
|
||||
- fxa_other
|
||||
- unexpected
|
||||
bugs:
|
||||
|
|
|
@ -513,6 +513,12 @@ class FxaClient(inner: FirefoxAccount, persistCallback: PersistCallback?) : Auto
|
|||
} catch (e: FxaException.Authentication) {
|
||||
FxaClientMetrics.errorCount["authentication"].add()
|
||||
throw e
|
||||
} catch (e: FxaException.NoExistingAuthFlow) {
|
||||
FxaClientMetrics.errorCount["no_existing_auth_flow"].add()
|
||||
throw e
|
||||
} catch (e: FxaException.OriginMismatch) {
|
||||
FxaClientMetrics.errorCount["origin_mismatch"].add()
|
||||
throw e
|
||||
} catch (e: FxaException) {
|
||||
FxaClientMetrics.errorCount["fxa_other"].add()
|
||||
throw e
|
||||
|
|
|
@ -38,6 +38,12 @@ pub enum FxaError {
|
|||
/// **Note:** This error is currently only thrown in the Swift language bindings.
|
||||
#[error("the requested authentication flow was not active")]
|
||||
WrongAuthFlow,
|
||||
/// Origin mismatch when handling a pairing flow
|
||||
///
|
||||
/// The most likely cause of this is that a user tried to pair together two firefox instances
|
||||
/// that are configured to use different servers.
|
||||
#[error("Origin mismatch")]
|
||||
OriginMismatch,
|
||||
/// A scoped key was missing in the server response when requesting the OLD_SYNC scope.
|
||||
#[error("The sync scoped key was missing")]
|
||||
SyncScopedKeyMissingInServerResponse,
|
||||
|
@ -194,17 +200,21 @@ impl GetErrorHandling for Error {
|
|||
| Error::NoRefreshToken
|
||||
| Error::NoScopedKey(_)
|
||||
| Error::NoCachedToken(_) => {
|
||||
ErrorHandling::convert(crate::FxaError::Authentication).log_warning()
|
||||
}
|
||||
Error::RequestError(_) => {
|
||||
ErrorHandling::convert(crate::FxaError::Network).log_warning()
|
||||
ErrorHandling::convert(FxaError::Authentication).log_warning()
|
||||
}
|
||||
Error::RequestError(_) => ErrorHandling::convert(FxaError::Network).log_warning(),
|
||||
Error::SyncScopedKeyMissingInServerResponse => {
|
||||
ErrorHandling::convert(crate::FxaError::SyncScopedKeyMissingInServerResponse)
|
||||
ErrorHandling::convert(FxaError::SyncScopedKeyMissingInServerResponse)
|
||||
.report_error("fxa-client-scoped-key-missing")
|
||||
}
|
||||
_ => ErrorHandling::convert(crate::FxaError::Other)
|
||||
.report_error("fxa-client-other-error"),
|
||||
Error::UnknownOAuthState => {
|
||||
ErrorHandling::convert(FxaError::NoExistingAuthFlow).log_warning()
|
||||
}
|
||||
Error::BackoffError(_) => {
|
||||
ErrorHandling::convert(FxaError::Other).report_error("fxa-client-backoff")
|
||||
}
|
||||
Error::OriginMismatch => ErrorHandling::convert(FxaError::OriginMismatch),
|
||||
_ => ErrorHandling::convert(FxaError::Other).report_error("fxa-client-other-error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,11 +59,8 @@ enum FxaError {
|
|||
// The application may retry at a later time once connectivity is restored.
|
||||
"Network",
|
||||
|
||||
// Thrown if the application attempts to complete an OAuth flow when no OAuth flow
|
||||
// has been initiated. This may indicate a user who navigated directly to the OAuth
|
||||
// `redirect_uri` for the application.
|
||||
//
|
||||
// **Note:** This error is currently only thrown in the Swift language bindings.
|
||||
// Thrown if the application attempts to complete an OAuth flow when no OAuth flow has been initiated for that state.
|
||||
// This may indicate a user who navigated directly to the OAuth `redirect_uri` for the application.
|
||||
"NoExistingAuthFlow",
|
||||
|
||||
// Thrown if the application attempts to complete an OAuth flow, but the state
|
||||
|
@ -75,6 +72,12 @@ enum FxaError {
|
|||
// **Note:** This error is currently only thrown in the Swift language bindings.
|
||||
"WrongAuthFlow",
|
||||
|
||||
// Origin mismatch when handling a pairing flow
|
||||
//
|
||||
// The most likely cause of this is that a user tried to pair together two firefox instances
|
||||
// that are configured to use different servers.
|
||||
"OriginMismatch",
|
||||
|
||||
// The sync scoped key was missing in the server response
|
||||
"SyncScopedKeyMissingInServerResponse",
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче