Skip to content

Commit

Permalink
More accurately tag serde_json errors
Browse files Browse the repository at this point in the history
Summary: ^

Reviewed By: JakobDegen

Differential Revision: D68221224

fbshipit-source-id: 25027a139b4c1284c9a9dc05b1c06c0ca6672210
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Jan 16, 2025
1 parent 6b8d19b commit d4b3a49
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/buck2_error/src/conversion/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@
* of this source tree.
*/

use serde_json::error::Category;

impl From<serde_json::Error> 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)
}
}

0 comments on commit d4b3a49

Please sign in to comment.