From d4b3a49523e9882da2f756ad1485ad56cd88f40d Mon Sep 17 00:00:00 2001 From: Will Li Date: Wed, 15 Jan 2025 18:41:51 -0800 Subject: [PATCH] More accurately tag serde_json errors Summary: ^ Reviewed By: JakobDegen Differential Revision: D68221224 fbshipit-source-id: 25027a139b4c1284c9a9dc05b1c06c0ca6672210 --- app/buck2_error/src/conversion/serde_json.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/buck2_error/src/conversion/serde_json.rs b/app/buck2_error/src/conversion/serde_json.rs index 399ae5cb18e8..43ab2619faf0 100644 --- a/app/buck2_error/src/conversion/serde_json.rs +++ b/app/buck2_error/src/conversion/serde_json.rs @@ -7,10 +7,17 @@ * of this source tree. */ +use serde_json::error::Category; + impl From for crate::Error { #[cold] #[track_caller] fn from(value: serde_json::Error) -> Self { - crate::conversion::from_any_with_tag(value, crate::ErrorTag::Tier0) + let error_tag = match value.classify() { + Category::Data | Category::Syntax => crate::ErrorTag::Input, + Category::Eof | Category::Io => crate::ErrorTag::Tier0, + }; + + crate::conversion::from_any_with_tag(value, error_tag) } }