File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,20 @@ pub unsafe extern "C" fn mj_err_get_debug_info() -> *mut c_char {
60
60
. and_then ( |x| {
61
61
let mut info = String :: new ( ) ;
62
62
if x. name ( ) . is_some ( ) {
63
- writeln ! ( info, "{}" , x. display_debug_info( ) ) . unwrap ( ) ;
63
+ let err_info = x. display_debug_info ( ) . to_string ( ) ;
64
+ if !err_info. is_empty ( ) {
65
+ writeln ! ( info, "{err_info}" ) . unwrap ( ) ;
66
+ }
64
67
}
65
68
let mut source_opt = x. source ( ) ;
66
69
while let Some ( source) = source_opt {
67
70
writeln ! ( info, "\n caused by: {source}" ) . unwrap ( ) ;
68
71
if let Some ( source) = source. downcast_ref :: < Error > ( ) {
69
72
if source. name ( ) . is_some ( ) {
70
- writeln ! ( info, "{}" , source. display_debug_info( ) ) . unwrap ( ) ;
73
+ let src_info = x. display_debug_info ( ) . to_string ( ) ;
74
+ if !src_info. is_empty ( ) {
75
+ writeln ! ( info, "{src_info}" ) . unwrap ( ) ;
76
+ }
71
77
}
72
78
}
73
79
source_opt = source. source ( ) ;
You can’t perform that action at this time.
0 commit comments