diff --git a/examples/scrape/go.mod b/examples/scrape/go.mod index d0e001d..d849268 100644 --- a/examples/scrape/go.mod +++ b/examples/scrape/go.mod @@ -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 => ../../ diff --git a/examples/scrape/main.go b/examples/scrape/main.go index d72330f..12920ae 100644 --- a/examples/scrape/main.go +++ b/examples/scrape/main.go @@ -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) + } } }