Skip to content

Commit

Permalink
Bug/326 overflow (#327)
Browse files Browse the repository at this point in the history
bug: Silence data overflow error in sentry

* also apply 1.63 clippy fixex

Closes: #326
  • Loading branch information
jrconlin authored Aug 17, 2022
1 parent 060a520 commit 202fba6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion autoendpoint/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ impl ApiErrorKind {
| ApiErrorKind::InvalidAuthentication
| ApiErrorKind::InvalidLocalAuth(_) |
// Ignore missing or invalid user errors
ApiErrorKind::NoUser | ApiErrorKind::NoSubscription,
ApiErrorKind::NoUser | ApiErrorKind::NoSubscription |
// Ignore overflow errors
ApiErrorKind::Router(RouterError::TooMuchData(_)),
)
}

Expand Down
2 changes: 1 addition & 1 deletion autoendpoint/src/extractors/routers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::str::FromStr;
use std::sync::Arc;

/// Valid `DynamoDbUser::router_type` values
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[allow(clippy::upper_case_acronyms)]
pub enum RouterType {
WebPush,
Expand Down
6 changes: 3 additions & 3 deletions autoendpoint/src/headers/vapid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use thiserror::Error;
pub const ALLOWED_SCHEMES: [&str; 3] = ["bearer", "webpush", "vapid"];

/// Parses the VAPID authorization header
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VapidHeader {
pub scheme: String,
pub token: String,
Expand All @@ -21,7 +21,7 @@ pub struct VapidHeaderWithKey {
}

/// Version-specific VAPID data. Also used to identify the VAPID version.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum VapidVersionData {
Version1,
Version2 { public_key: String },
Expand Down Expand Up @@ -77,7 +77,7 @@ impl VapidHeader {
}
}

#[derive(Debug, Error, PartialEq)]
#[derive(Debug, Error, Eq, PartialEq)]
pub enum VapidError {
#[error("Missing VAPID token")]
MissingToken,
Expand Down
1 change: 1 addition & 0 deletions autoendpoint/src/routers/apns/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ mod tests {
const DEVICE_TOKEN: &str = "test-token";
const APNS_ID: &str = "deadbeef-4f5e-4403-be8f-35d0251655f5";

#[allow(clippy::type_complexity)]
/// A mock APNS client which allows one to supply a custom APNS response/error
struct MockApnsClient {
send_fn: Box<dyn Fn(Payload<'_>) -> Result<a2::Response, a2::Error> + Send + Sync>,
Expand Down
2 changes: 1 addition & 1 deletion autoendpoint/src/routers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub trait Router {
}

/// The response returned when a router routes a notification
#[derive(Debug, PartialEq)]
#[derive(Debug, Eq, PartialEq)]
pub struct RouterResponse {
pub status: StatusCode,
pub headers: HashMap<&'static str, String>,
Expand Down
2 changes: 1 addition & 1 deletion autopush-common/src/db/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl From<HashMap<String, String>> for NotificationHeaders {
}
}

#[derive(Deserialize, PartialEq, Debug, Clone, Serialize)]
#[derive(Deserialize, Eq, PartialEq, Debug, Clone, Serialize)]
pub struct DynamoDbUser {
// DynamoDB <Hash key>
#[serde(serialize_with = "uuid_serializer")]
Expand Down
2 changes: 1 addition & 1 deletion autopush/src/megaphone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct BroadcastRevision {

// A provided Broadcast/Version used for `BroadcastSubsInit`, client comparisons, and outgoing
// deltas
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Broadcast {
broadcast_id: String,
version: String,
Expand Down

0 comments on commit 202fba6

Please sign in to comment.