@@ -84,16 +84,31 @@ and pp_record_error custom_error ppf = function
8484 (pp_validation_error custom_error)
8585 error
8686
87- let pp_provider_error custom_error ppf = function
87+ let pp_source_label ppf label = function
88+ | None -> Format. fprintf ppf " %s:@." label
89+ | Some src -> Format. fprintf ppf " %s in: %a@." label Path. pp src
90+
91+ let pp_entity ppf entity = Format. fprintf ppf " Entity: `%s`@,@." entity
92+
93+ let pp_target ppf = function
94+ | None -> ()
95+ | Some tgt ->
96+ Format. fprintf ppf " Unable to write to target %a:@,@," Path. pp tgt
97+
98+ let pp_provider_error custom_error ~source ~target ppf = function
8899 | Required. Parsing_error { given; message } ->
89- Format. fprintf ppf " Parsing error:@,Given: `%s`@,Message: `%s`" given
90- message
100+ pp_target ppf target;
101+ pp_source_label ppf " Parsing error" source;
102+ Format. fprintf ppf " @.Given:@.%s@.Message: `%s`" given message
91103 | Required. Required_metadata { entity } ->
92- Format. fprintf ppf " Required metadata: `%s`" entity
104+ pp_target ppf target;
105+ pp_source_label ppf " Required metadata" source;
106+ pp_entity ppf entity
93107 | Required. Validation_error { entity; error } ->
94- Format. fprintf ppf " Validation error: `%s`@,@[%a@]" entity
95- (pp_validation_error custom_error)
96- error
108+ pp_target ppf target;
109+ pp_source_label ppf " Validation error" source;
110+ pp_entity ppf entity;
111+ Format. fprintf ppf " @,@[%a@]" (pp_validation_error custom_error) error
97112
98113let glob_pp p v backtrace ppf =
99114 Format. fprintf ppf " --- %a ---@,%a@,---@,%s" Lexicon. there_is_an_error () p v
@@ -118,7 +133,8 @@ let exception_to_diagnostic
118133 glob_pp (Lexicon. directory_not_exists source path) ()
119134 | Eff. Directory_is_a_file (source , path ) ->
120135 glob_pp (Lexicon. directory_is_a_file source path) ()
121- | Eff. Provider_error error -> glob_pp (pp_provider_error custom_error) error
136+ | Eff. Provider_error { source; target; error } ->
137+ glob_pp (pp_provider_error custom_error ~source ~target ) error
122138 | exn -> glob_pp Lexicon. unknown_error exn
123139
124140let runtime_error_to_diagnostic ppf message =
0 commit comments