Skip to content

Commit

Permalink
examples: Improve error message when running outside examples directory
Browse files Browse the repository at this point in the history
  • Loading branch information
psiemens committed Jun 5, 2020
1 parent 6c6cbdd commit 3178330
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 3178330

Please sign in to comment.