From 32ef6c8cfc4a53e4f72b267d61bfcc7f65047f31 Mon Sep 17 00:00:00 2001 From: Manish R Jain <manishrjain@gmail.com> Date: Tue, 10 May 2016 18:22:13 +1000 Subject: [PATCH] Output the offending line in error log if rdf.Parse fails. --- rdf/parse.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rdf/parse.go b/rdf/parse.go index f8501c4e..be0d5611 100644 --- a/rdf/parse.go +++ b/rdf/parse.go @@ -139,7 +139,7 @@ func Parse(line string) (rnq NQuad, rerr error) { // TODO: Strictly parse common types like integers, floats etc. if len(oval) == 0 { glog.Fatalf( - "itemObject should be emitted before itemObjectType. Input: %q", + "itemObject should be emitted before itemObjectType. Input: [%s]", line) } oval += "@@" + stripBracketsIfPresent(item.Val) @@ -155,16 +155,16 @@ func Parse(line string) (rnq NQuad, rerr error) { } } if !vend { - return rnq, fmt.Errorf("Invalid end of input") + return rnq, fmt.Errorf("Invalid end of input. Input: [%s]", line) } if len(oval) > 0 { rnq.ObjectValue = oval } if len(rnq.Subject) == 0 || len(rnq.Predicate) == 0 { - return rnq, fmt.Errorf("Empty required fields in NQuad") + return rnq, fmt.Errorf("Empty required fields in NQuad. Input: [%s]", line) } if len(rnq.ObjectId) == 0 && rnq.ObjectValue == nil { - return rnq, fmt.Errorf("No Object in NQuad") + return rnq, fmt.Errorf("No Object in NQuad. Input: [%s]", line) } return rnq, nil -- GitLab