Skip to content

Commit

Permalink
Summary: Fix to use error wrapper correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
leowmjw committed Jul 14, 2020
1 parent e1ee59a commit 7c3c132
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions internal/debate/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ func (pdfDoc *PDFDocument) extractPDFStylesOnly(options *ExtractPDFOptions) erro
if p.V.IsNull() {
continue
}
pt, pterr := p.GetPlainText(nil)
_, pterr := p.GetPlainText(nil)
if pterr != nil {
if pterr.Error() == "malformed PDF: reading at offset 0: stream not present" {
fmt.Println("**WILL IGNORE!!!! *****")
continue
}
return fmt.Errorf(" GetPlainText ERROR: %w", pt)
return fmt.Errorf(" GetPlainText ERROR: %w", pterr)
}

// Top 10
Expand Down Expand Up @@ -151,13 +151,13 @@ func (pdfDoc *PDFDocument) extractPDFLinesOnly(options *ExtractPDFOptions) error
if p.V.IsNull() {
continue
}
pt, pterr := p.GetPlainText(nil)
_, pterr := p.GetPlainText(nil)
if pterr != nil {
if pterr.Error() == "malformed PDF: reading at offset 0: stream not present" {
fmt.Println("**WILL IGNORE!!!! *****")
continue
}
return fmt.Errorf(" GetPlainText ERROR: %w", pt)
return fmt.Errorf(" GetPlainText ERROR: %w", pterr)
}

// Top 10 lines for this page by line analysis
Expand Down Expand Up @@ -217,13 +217,13 @@ func (pdfDoc *PDFDocument) extractPDF(options *ExtractPDFOptions) error {
continue
}
// copy over plain text; short form
pt, pterr := p.GetPlainText(nil)
_, pterr := p.GetPlainText(nil)
if pterr != nil {
if pterr.Error() == "malformed PDF: reading at offset 0: stream not present" {
fmt.Println("**WILL IGNORE!!!! *****")
continue
}
return fmt.Errorf(" GetPlainText ERROR: %w", pt)
return fmt.Errorf(" GetPlainText ERROR: %w", pterr)
}
// NO need this ,.
//pdfPage.PDFPlainText = pt
Expand Down
2 changes: 1 addition & 1 deletion internal/hansard/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (pdfDoc *PDFDocument) extractPDF() error {
fmt.Println("**WILL IGNORE!!!! *****")
continue
}
return fmt.Errorf(" GetPlainText ERROR: %w", pt)
return fmt.Errorf(" GetPlainText ERROR: %w", pterr)
}
pdfPage.PDFPlainText = pt
// processStyleChanges ..
Expand Down

0 comments on commit 7c3c132

Please sign in to comment.