Skip to main content

json_depth_error_message

Function json_depth_error_message 

Source
pub fn json_depth_error_message(depth: usize) -> String
Expand description

Message text for a JSON payload rejected for nesting deeper than MAX_JSON_NESTING_DEPTH.

The single shared wording for every workspace call site that rejects on JSON nesting depth, whether it reports the rejection via serde_json::Error (as json_depth_error does, for parse_json_checked’s callers) or via its own error type (a caller whose depth check runs against an already-parsed AST rather than raw bytes, and so cannot route through parse_json_checked itself, e.g. deps-deno’s parse_deno_json) — kept as one function so the two paths cannot silently drift apart.

§Examples

use deps_core::parser::json_depth_error_message;

assert_eq!(
    json_depth_error_message(65),
    "JSON nesting depth 65 exceeds maximum of 64"
);