From 84027250b4592dc5db32e60bfd070fa7592a2835 Mon Sep 17 00:00:00 2001 From: fillol <55287657+Darklabel91@users.noreply.github.com> Date: Sun, 24 Apr 2022 16:38:52 -0300 Subject: [PATCH] Error handling improved --- CSV/analyzeCSV.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CSV/analyzeCSV.go b/CSV/analyzeCSV.go index acfbfbd..68d1b9a 100644 --- a/CSV/analyzeCSV.go +++ b/CSV/analyzeCSV.go @@ -27,7 +27,20 @@ func createCSVs(raw []string, nameResultFolder string) error { var analyzeCNJCSV []CNJ.AnalysisCNJ for _, cnj := range raw { - dataReturn, _ := CNJ.AnalyzeCNJ(cnj) + dataReturn, err := CNJ.AnalyzeCNJ(cnj) + if err != nil { + analyzeCNJCSV = append(analyzeCNJCSV, CNJ.AnalysisCNJ{ + ReceivedCNJ: err.Error(), + ValidCNJ: false, + SegmentName: err.Error(), + SegmentShort: err.Error(), + SourceUnitType: err.Error(), + SourceUnitNumber: err.Error(), + CourtType: err.Error(), + CourtNumber: err.Error(), + Detailed: CNJ.DecomposedCNJ{}, + }) + } analyzeCNJCSV = append(analyzeCNJCSV, dataReturn) }