Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/batch_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ mod tests {
core_count: None,
entry_data: "{}".to_string(),
context: None,
handled: None,
created_at: Utc::now(),
}),
tracking: None,
Expand Down
1 change: 1 addition & 0 deletions src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ pub async fn insert_error_entries(
core_count: params.details.core_count,
entry_data: params.details.entry_data,
context: params.context,
handled: data.handled,
created_at,
};

Expand Down
16 changes: 16 additions & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub struct ErrorTracking {
pub session_id: Option<String>,
#[serde(default, rename = "buildId")]
pub build_id: Option<String>,
pub handled: Option<bool>,
}

#[derive(Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -116,6 +117,21 @@ mod tests {
let errors = req.errors.unwrap();
assert_eq!(errors.len(), 1);
assert_eq!(errors[0].error.error, "Error");
assert_eq!(errors[0].handled, None);
assert_eq!(req.session_id, Some("mkqsr2zu-rhhe8v3j".to_string()));
}

#[test]
fn test_error_tracking_handled_parsing() {
let json = r#"{
"hash": "err_3d39cc9f28fb81e8b7064481c7deb8c0bb349cb0877558cc73b677c1fb9a704d",
"error": "Error",
"message": "Uncaught Error: Render error",
"handled": true
}"#;

let result = serde_json::from_str::<ErrorTracking>(json);
assert!(result.is_ok(), "Failed to parse: {:?}", result.err());
assert_eq!(result.unwrap().handled, Some(true));
}
}
1 change: 1 addition & 0 deletions src/tinybird.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub struct ErrorTrackingRow {
pub core_count: Option<f64>,
pub entry_data: String,
pub context: Option<String>,
pub handled: Option<bool>,
#[serde(with = "chrono::serde::ts_milliseconds")]
pub created_at: DateTime<Utc>,
}
Expand Down