Skip to content
Snippets Groups Projects
Commit d1ba995c authored by Manish R Jain's avatar Manish R Jain
Browse files

Merge pull request #80 from dgraph-io/dmuts

Output the offending line in error log if rdf.Parse fails.
parents b1e91934 32ef6c8c
No related branches found
No related tags found
No related merge requests found
...@@ -139,7 +139,7 @@ func Parse(line string) (rnq NQuad, rerr error) { ...@@ -139,7 +139,7 @@ func Parse(line string) (rnq NQuad, rerr error) {
// TODO: Strictly parse common types like integers, floats etc. // TODO: Strictly parse common types like integers, floats etc.
if len(oval) == 0 { if len(oval) == 0 {
glog.Fatalf( glog.Fatalf(
"itemObject should be emitted before itemObjectType. Input: %q", "itemObject should be emitted before itemObjectType. Input: [%s]",
line) line)
} }
oval += "@@" + stripBracketsIfPresent(item.Val) oval += "@@" + stripBracketsIfPresent(item.Val)
...@@ -155,16 +155,16 @@ func Parse(line string) (rnq NQuad, rerr error) { ...@@ -155,16 +155,16 @@ func Parse(line string) (rnq NQuad, rerr error) {
} }
} }
if !vend { 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 { if len(oval) > 0 {
rnq.ObjectValue = oval rnq.ObjectValue = oval
} }
if len(rnq.Subject) == 0 || len(rnq.Predicate) == 0 { 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 { 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 return rnq, nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment