fix: add err handling to db queries (#2064)

* fix: add err handling to db queries

* chore: add error handling to GetApp

* chore: wrap the original error

* fix: retrieve balance after err != nil check

* chore: minor code cleanup

* chore: add error handling to app permission listing in GetApp

* chore: convert GetBudgetUsageSat to GetBudgetUsage

* chore: add tests for GetBudgetUsage

* chore: separate budget window tests

---------

Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
This commit is contained in:
Adithya Vardhan 2026-02-27 15:01:25 +05:30 committed by GitHub
parent 4a924c3d11
commit 3aa167a7c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 387 additions and 45 deletions

View file

@ -1051,7 +1051,12 @@ func (httpSvc *HttpService) appsShowByPubkeyHandler(c echo.Context) error {
})
}
response := httpSvc.api.GetApp(dbApp)
response, err := httpSvc.api.GetApp(dbApp)
if err != nil {
return c.JSON(http.StatusInternalServerError, ErrorResponse{
Message: err.Error(),
})
}
return c.JSON(http.StatusOK, response)
}
@ -1079,7 +1084,12 @@ func (httpSvc *HttpService) appsShowHandler(c echo.Context) error {
})
}
response := httpSvc.api.GetApp(dbApp)
response, err := httpSvc.api.GetApp(dbApp)
if err != nil {
return c.JSON(http.StatusInternalServerError, ErrorResponse{
Message: err.Error(),
})
}
return c.JSON(http.StatusOK, response)
}