Skip to content

Commit d4f82bd

Browse files
devin-ai-integration[bot]Convex, Inc.
authored andcommitted
Replace PII with cron job ID in error messages and use ErrorMetadata pattern (#37253)
GitOrigin-RevId: a47f8efec5fac367021d431ec206e1ab4f509fa5
1 parent 19debbc commit d4f82bd

File tree

1 file changed

+21
-12
lines changed
  • crates/application/src/cron_jobs

1 file changed

+21
-12
lines changed

crates/application/src/cron_jobs/mod.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ use database::{
4444
Database,
4545
Transaction,
4646
};
47-
use errors::ErrorMetadataAnyhowExt;
47+
use errors::{
48+
ErrorMetadata,
49+
ErrorMetadataAnyhowExt,
50+
};
4851
use fastrace::future::FutureExt as _;
4952
use futures::{
5053
future::Either,
@@ -763,10 +766,10 @@ impl<RT: Runtime> CronJobContext<RT> {
763766
next_ts = compute_next_ts(&job.cron_spec, Some(next_ts), now)?;
764767
}
765768
if num_skipped > 0 {
766-
let name = &job.name;
769+
let job_id = job.id.developer_id;
767770
tracing::info!(
768-
"Skipping {num_skipped} run(s) of {name} because multiple scheduled runs are in \
769-
the past"
771+
"Skipping {num_skipped} run(s) of job {job_id} because multiple scheduled runs \
772+
are in the past"
770773
);
771774
match udf_type {
772775
// These aren't system errors in the sense that they represent an issue with Convex
@@ -776,10 +779,13 @@ impl<RT: Runtime> CronJobContext<RT> {
776779
UdfType::Mutation => {
777780
self.function_log
778781
.log_mutation_system_error(
779-
&anyhow::anyhow!(
780-
"Skipping {num_skipped} run(s) of {name} because multiple \
781-
scheduled runs are in the past"
782-
),
782+
&anyhow::anyhow!(ErrorMetadata::bad_request(
783+
"SkippingPastScheduledRuns",
784+
format!(
785+
"Skipping {num_skipped} run(s) of job {job_id} because \
786+
multiple scheduled runs are in the past"
787+
)
788+
)),
783789
CanonicalizedComponentFunctionPath {
784790
component: component_path,
785791
udf_path: job.cron_spec.udf_path.clone(),
@@ -800,10 +806,13 @@ impl<RT: Runtime> CronJobContext<RT> {
800806
mutation_retry_count.is_none(),
801807
"Actions should not have mutation_retry_count set"
802808
);
803-
let mut err = anyhow::anyhow!(
804-
"Skipping {num_skipped} run(s) of {name} because multiple scheduled runs \
805-
are in the past"
806-
);
809+
let mut err = anyhow::anyhow!(ErrorMetadata::bad_request(
810+
"SkippingPastScheduledRuns",
811+
format!(
812+
"Skipping {num_skipped} run(s) of job {job_id} because multiple \
813+
scheduled runs are in the past"
814+
)
815+
));
807816
self.function_log
808817
.log_action_system_error(
809818
&err,

0 commit comments

Comments
 (0)