-module(prequel@error@pipeline_error). -compile([no_auto_import, nowarn_unused_vars]). -export([format/3]). -export_type([pipeline_error/0]). -type pipeline_error() :: {parsing_failure, prequel@error@parse_error:parse_error()} | {validation_failure, non_empty_list:non_empty_list(prequel@error@validation_error:validation_error())}. -spec format(pipeline_error(), binary(), binary()) -> gleam@string_builder:string_builder(). format(Error, File_name, Source_code) -> case Error of {parsing_failure, Error@1} -> _pipe = prequel@error@parse_error:to_report( Error@1, File_name, Source_code ), prequel@internals@report:format(_pipe); {validation_failure, Errors} -> _pipe@1 = Errors, _pipe@2 = non_empty_list:to_list(_pipe@1), _pipe@3 = gleam@list:map( _pipe@2, fun(_capture) -> prequel@error@validation_error:to_report( _capture, File_name, Source_code ) end ), _pipe@4 = gleam@list:map( _pipe@3, fun prequel@internals@report:format/1 ), gleam@string_builder:join(_pipe@4, <<"\n\n\n"/utf8>>) end.