Skip to content

Commit

Permalink
Update the example
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Oct 18, 2023
1 parent fddb6ae commit 1c881fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/scrape/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ module scrape
go 1.21.0

require github.com/stealthrocket/coroutine v0.0.0-20230927150141-7c62a3508ce8

replace github.com/stealthrocket/coroutine => ../../
6 changes: 5 additions & 1 deletion examples/scrape/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ func main() {
log.Fatal(err)
}
} else if _, err := coro.Context().Unmarshal(state); err != nil {
log.Fatal(err)
if errors.Is(err, coroutine.ErrInvalidState) {
log.Println("warning: coroutine state is no longer valid. Starting fresh")
} else {
log.Fatal(err)
}
}
}

Expand Down

0 comments on commit 1c881fd

Please sign in to comment.