mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-16 10:31:11 +01:00
Add status code when panic-ing
This commit is contained in:
parent
c7862b1522
commit
dba1e9a5db
@ -191,7 +191,7 @@ If you'd like to temporarily allow someone else to search your shell history, yo
|
||||
|
||||
![demo showing the web UI searching for git](https://raw.githubusercontent.com/ddworken/hishtory/master/backend/web/landing/www/img/webui.png)
|
||||
|
||||
Note that this uses [HTTP Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), so the credentials are sent over your local network via HTTP!
|
||||
Note that this uses [HTTP Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), so the credentials are sent over your local network via HTTP.
|
||||
|
||||
</blockquote></details>
|
||||
|
||||
|
@ -30,7 +30,7 @@ type webUiData struct {
|
||||
func getTableRowsForDisplay(ctx context.Context, searchQuery string) ([][]string, error) {
|
||||
results, err := lib.Search(ctx, hctx.GetDb(ctx), searchQuery, 100)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return nil, err
|
||||
}
|
||||
return buildTableRows(ctx, results)
|
||||
}
|
||||
@ -39,6 +39,7 @@ func htmx_resultsTable(w http.ResponseWriter, r *http.Request) {
|
||||
searchQuery := r.URL.Query().Get("q")
|
||||
tableRows, err := getTableRowsForDisplay(r.Context(), searchQuery)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
panic(err)
|
||||
}
|
||||
w.Header().Add("Content-Type", "text/html")
|
||||
@ -49,6 +50,7 @@ func htmx_resultsTable(w http.ResponseWriter, r *http.Request) {
|
||||
ColumnNames: hctx.GetConf(r.Context()).DisplayedColumns,
|
||||
})
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@ -74,6 +76,7 @@ func webuiHandler(w http.ResponseWriter, r *http.Request) {
|
||||
searchQuery := r.URL.Query().Get("q")
|
||||
tableRows, err := getTableRowsForDisplay(r.Context(), searchQuery)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
panic(err)
|
||||
}
|
||||
w.Header().Add("Content-Type", "text/html")
|
||||
@ -83,6 +86,7 @@ func webuiHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ColumnNames: hctx.GetConf(r.Context()).DisplayedColumns,
|
||||
})
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user