Skip to content

Commit 1a7a3b0

Browse files
authored
show more details in InvalidOrigin error message (#7110)
1 parent d18a74c commit 1a7a3b0

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

components/logins/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ pub enum InvalidLogin {
131131
NoTarget,
132132
// Login has an illegal origin field, split off from IllegalFieldValue since this is a known
133133
// issue with the Desktop logins and we don't want to report it to Sentry (see #5233).
134-
#[error("Login has illegal origin")]
135-
IllegalOrigin,
134+
#[error("Login has illegal origin: {reason}")]
135+
IllegalOrigin { reason: String },
136136
#[error("Login has illegal field: {field_info}")]
137137
IllegalFieldValue { field_info: String },
138138
}

components/logins/src/login.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ impl LoginEntry {
435435
error_support::redact_url(origin)
436436
);
437437
// We can't fixup completely invalid records, so always throw.
438-
Err(InvalidLogin::IllegalOrigin.into())
438+
Err(InvalidLogin::IllegalOrigin {
439+
reason: e.to_string(),
440+
}
441+
.into())
439442
}
440443
}
441444
}
@@ -1129,7 +1132,8 @@ mod tests {
11291132
TestCase {
11301133
login: login_with_malformed_origin_parens,
11311134
should_err: true,
1132-
expected_err: "Invalid login: Login has illegal origin",
1135+
expected_err:
1136+
"Invalid login: Login has illegal origin: relative URL without a base",
11331137
},
11341138
TestCase {
11351139
login: login_with_host_unicode,

components/logins/src/sync/engine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl LoginsSyncEngine {
144144
match e {
145145
// This is a known error with Desktop logins (see #5233), just log it
146146
// rather than reporting to sentry
147-
Error::InvalidLogin(InvalidLogin::IllegalOrigin) => {
147+
Error::InvalidLogin(InvalidLogin::IllegalOrigin { reason: _ }) => {
148148
warn!("logins-deserialize-error: {e}");
149149
}
150150
// For all other errors, report them to Sentry

0 commit comments

Comments
 (0)