Check cascade depth and return a clear error if exceeded.
(cascade_depth: u32, collection: &str)
| 17 | |
| 18 | /// Check cascade depth and return a clear error if exceeded. |
| 19 | pub fn check_cascade_depth(cascade_depth: u32, collection: &str) -> crate::Result<()> { |
| 20 | if cascade_depth >= MAX_CASCADE_DEPTH { |
| 21 | return Err(crate::Error::BadRequest { |
| 22 | detail: format!( |
| 23 | "trigger cascade depth exceeded ({MAX_CASCADE_DEPTH}): \ |
| 24 | possible infinite loop on collection '{collection}'" |
| 25 | ), |
| 26 | }); |
| 27 | } |
| 28 | Ok(()) |
| 29 | } |
| 30 | |
| 31 | /// Execute a list of triggers with the given bindings. |
| 32 | /// |
no outgoing calls