Skip to content

Commit 40ccaa5

Browse files
author
Norbert Kamiński
committed
status.rs: Make json output more verbose
Currently if the status response has no status code, json output contains only a text field which gives no real information about the cause of the problem. The patch adds field with more detailed information when the status response contains some details. Signed-off-by: Norbert Kamiński <[email protected]>
1 parent 54e6386 commit 40ccaa5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lychee-lib/src/types/status.rs

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ impl Serialize for Status {
6868
s = serializer.serialize_struct("Status", 2)?;
6969
s.serialize_field("text", &self.to_string())?;
7070
s.serialize_field("code", &code.as_u16())?;
71+
} else if let Some(details) = self.details() {
72+
s = serializer.serialize_struct("Status", 2)?;
73+
s.serialize_field("text", &self.to_string())?;
74+
s.serialize_field("details", &details.to_string())?;
7175
} else {
7276
s = serializer.serialize_struct("Status", 1)?;
7377
s.serialize_field("text", &self.to_string())?;

0 commit comments

Comments
 (0)