Better exec fail errors

This commit is contained in:
lash 2025-01-13 07:54:05 +00:00
parent 53d09688c1
commit d3cba8ab55
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -93,44 +93,44 @@ func main() {
menuStorageService := storage.NewMenuStorageService(connData, "") menuStorageService := storage.NewMenuStorageService(connData, "")
rs, err := menuStorageService.GetResource(ctx) rs, err := menuStorageService.GetResource(ctx)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "menustorageservice: %v\n", err)
os.Exit(1) os.Exit(1)
} }
userdataStore, err := menuStorageService.GetUserdataDb(ctx) userdataStore, err := menuStorageService.GetUserdataDb(ctx)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "userdatadb: %v\n", err)
os.Exit(1) os.Exit(1)
} }
defer userdataStore.Close() defer userdataStore.Close()
dbResource, ok := rs.(*resource.DbResource) dbResource, ok := rs.(*resource.DbResource)
if !ok { if !ok {
fmt.Fprintf(os.Stderr, "dbresource\n")
os.Exit(1) os.Exit(1)
} }
lhs, err := handlers.NewLocalHandlerService(ctx, pfp, true, dbResource, cfg, rs) lhs, err := handlers.NewLocalHandlerService(ctx, pfp, true, dbResource, cfg, rs)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "localhandlerservice: %v\n", err)
os.Exit(1) os.Exit(1)
} }
lhs.SetDataStore(&userdataStore) lhs.SetDataStore(&userdataStore)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "setdatastore: %v\n", err)
os.Exit(1) os.Exit(1)
} }
accountService := &httpremote.HTTPAccountService{} accountService := &httpremote.HTTPAccountService{}
hl, err := lhs.GetHandler(accountService) hl, err := lhs.GetHandler(accountService)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "httpaccountservice: %v\n", err)
os.Exit(1) os.Exit(1)
} }
stateStore, err := menuStorageService.GetStateStore(ctx) stateStore, err := menuStorageService.GetStateStore(ctx)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, "getstatestore: %v\n", err)
os.Exit(1) os.Exit(1)
} }
defer stateStore.Close() defer stateStore.Close()