Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit c8a19d2

Browse files
Add simple error handler
1 parent fd21cde commit c8a19d2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

go/errors.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package main
2+
3+
import (
4+
"log"
5+
)
6+
7+
func handleError(err error, message string) {
8+
if message == "" {
9+
message = "Error making API call"
10+
}
11+
if err != nil {
12+
log.Fatalf(message + ": %v", err.Error())
13+
}
14+
}

0 commit comments

Comments
 (0)