From 317833084e4b68c187349eb490d9b9e4c0aa3c26 Mon Sep 17 00:00:00 2001 From: Peter Siemens Date: Thu, 4 Jun 2020 17:46:48 -0700 Subject: [PATCH] examples: Improve error message when running outside examples directory --- examples/examples.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/examples.go b/examples/examples.go index b1bf1c0bd..c92684061 100644 --- a/examples/examples.go +++ b/examples/examples.go @@ -62,7 +62,15 @@ type config struct { func readConfig() config { f, err := os.Open(configPath) - Handle(err) + if err != nil { + if os.IsNotExist(err) { + fmt.Println("Emulator examples must be run from the flow-go-sdk/examples directory. Please see flow-go-sdk/examples/README.md for more details.") + } else { + fmt.Printf("Failed to load config from %s: %s\n", configPath, err.Error()) + } + + os.Exit(1) + } d := json.NewDecoder(f)