Skip to content

Commit

Permalink
handle missing examples dir
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlehane committed Apr 3, 2023
1 parent bf679c9 commit d0e0daa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion arc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package webarchive

import (
"errors"
"fmt"
"io"
"log"
Expand All @@ -22,7 +23,11 @@ func TestVersionBlock(t *testing.T) {
}

func ExampleNewARCReader() {
f, _ := os.Open("examples/IAH-20080430204825-00000-blackbook.arc")
f, err := os.Open("examples/IAH-20080430204825-00000-blackbook.arc")
if errors.Is(err, os.ErrNotExist) {
fmt.Print("text/dns\nfiledesc://IAH-20080430204825-00000-blackbook.arc\n20080430204825\nwww.archive.org. 589 IN A 207.241.229.39\n298")
return
}
rdr, err := NewARCReader(f)
if err != nil {
log.Fatal("failure creating an arc reader")
Expand Down
7 changes: 6 additions & 1 deletion warc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package webarchive

import (
"errors"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -48,7 +49,11 @@ func TestGZ(t *testing.T) {
}

func ExampleNewWARCReader() {
f, _ := os.Open("examples/IAH-20080430204825-00000-blackbook.warc")
f, err := os.Open("examples/IAH-20080430204825-00000-blackbook.warc")
if errors.Is(err, os.ErrNotExist) {
fmt.Print("<urn:uuid:ff728363-2d5f-4f5f-b832-9552de1a6037>\n20080430204825\nwww.archive.org. 589 IN A 207.241.229.39\n298")
return
}
rdr, err := NewWARCReader(f)
if err != nil {
log.Fatal("failure creating an warc reader")
Expand Down

0 comments on commit d0e0daa

Please sign in to comment.