From 2d6bfbfacfa45899a54f8afd788fa0a3a9aa28d1 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 18 Dec 2023 15:01:47 -0300 Subject: [PATCH] feat(fs): include full error message (#826) --- .changes/fs-improve-error-message.md | 5 +++++ plugins/fs/src/commands.rs | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changes/fs-improve-error-message.md diff --git a/.changes/fs-improve-error-message.md b/.changes/fs-improve-error-message.md new file mode 100644 index 00000000..3ceb0ec6 --- /dev/null +++ b/.changes/fs-improve-error-message.md @@ -0,0 +1,5 @@ +--- +"fs": patch +--- + +Fix promise rejection error only containing the context and stripping the actual error message. diff --git a/plugins/fs/src/commands.rs b/plugins/fs/src/commands.rs index 59255796..ac0893a7 100644 --- a/plugins/fs/src/commands.rs +++ b/plugins/fs/src/commands.rs @@ -36,7 +36,11 @@ impl Serialize for CommandError { where S: Serializer, { - serializer.serialize_str(self.to_string().as_ref()) + if let Self::Anyhow(err) = self { + serializer.serialize_str(format!("{err:#}").as_ref()) + } else { + serializer.serialize_str(self.to_string().as_ref()) + } } }