all repos — artbound-go @ e93f6facc7a759881a3f2e093b267a13c8626cae

The official administration panel for ArtBound, by EarthBound Café.

other bugfixes
Marco Andronaco andronacomarco@gmail.com
Fri, 22 Dec 2023 14:57:21 +0100
commit

e93f6facc7a759881a3f2e093b267a13c8626cae

parent

79e63cd2787ece34f59ee8d885803aefcccf2945

2 files changed, 5 insertions(+), 7 deletions(-)

jump to
M artbound.goartbound.go

@@ -67,7 +67,7 @@ return

} err := db.Clear() if err != nil { - log.Fatal("Error:", err) + log.Println("Error:", err) http.Error(w, "Could not delete cache.", http.StatusInternalServerError) } http.Error(w, "Done.", http.StatusOK)

@@ -132,13 +132,11 @@

spreadsheetId := os.Getenv("SPREADSHEET_ID") if spreadsheetId == "" { log.Fatal("Please fill out SPREADSHEET_ID in .env") - os.Exit(1) } spreadsheetRange := os.Getenv("SPREADSHEET_RANGE") if spreadsheetRange == "" { log.Fatal("Please fill out SPREADSHEET_RANGE in .env") - os.Exit(1) } fs := http.FileServer(http.Dir("./static"))
M cache/cache.gocache/cache.go

@@ -88,7 +88,7 @@ }

log.Println(entry.FileID, "is not cached. Downloading.") ext, err := getFile(&db.googleApi, entry.FileID, cachePath) if err != nil { - log.Fatal("Could not download file", entry.FileID) + log.Println("Could not download file", entry.FileID) } return ext }

@@ -96,7 +96,7 @@

func InitDB(spreadsheetId string, spreadsheetRange string) *DB { files, err := listCachedEntries(cachePath) if err != nil { - log.Fatal("Could not list cached entries.") + log.Println("Could not list cached entries.") } googleApi := initGoogleAPI(spreadsheetId, spreadsheetRange) db := &DB{time.Now(), []Entry{}, files, *googleApi}

@@ -107,7 +107,7 @@

func (db *DB) update() (error, int) { entries, err := getEntries(&db.googleApi) if err != nil { - log.Fatal("Could not update DB!", err) + log.Println("Could not update DB!", err) return err, 0 } newEntries := len(entries) - len(db.Entries)

@@ -119,7 +119,7 @@

func (db *DB) UpdateCall() UpdateDBPayload { err, newEntries := db.update() if err != nil { - log.Fatal("Could not update DB!", err) + log.Println("Could not update DB!", err) newEntries = 0 } return UpdateDBPayload{db.LastUpdated.Format("02/01/2006 15:04"), newEntries}