[PR #450] [MERGED] refactor:pass ctx to db layer, return err instead of recover panic #600

Closed
opened 2026-02-25 23:34:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-shiori/shiori/pull/450
Author: @hulb
Created: 7/10/2022
Status: Merged
Merged: 9/30/2022
Merged by: @fmartingr

Base: masterHead: feat/pass-ctx-to-db


📝 Commits (2)

  • 4c74da2 refactor:pass ctx to db layer, return err instead of recover panic
  • b33aeed Merge branch 'feat/pass-ctx-to-db' into master-new

📊 Changes

20 files changed (+875 additions, -702 deletions)

View changed files

📝 go.mod (+2 -1)
📝 internal/cmd/add.go (+2 -2)
📝 internal/cmd/check.go (+2 -2)
📝 internal/cmd/delete.go (+1 -1)
📝 internal/cmd/export.go (+1 -1)
📝 internal/cmd/import.go (+9 -3)
📝 internal/cmd/open.go (+1 -1)
📝 internal/cmd/pocket.go (+9 -3)
📝 internal/cmd/print.go (+1 -1)
📝 internal/cmd/root.go (+12 -11)
📝 internal/cmd/update.go (+4 -4)
📝 internal/cmd/utils.go (+1 -1)
📝 internal/database/database.go (+41 -17)
📝 internal/database/mysql.go (+214 -205)
📝 internal/database/pg.go (+217 -201)
📝 internal/database/sqlite.go (+278 -215)
📝 internal/webserver/handler-api-ext.go (+15 -6)
📝 internal/webserver/handler-api.go (+52 -22)
📝 internal/webserver/handler-ui.go (+12 -4)
📝 internal/webserver/utils.go (+1 -1)

📄 Description

This PR makes a refactor of ways to handle error in db layer. I don't think it's proper to panic when there is an error in db actions. And every db action should be executed with a context passed by the caller.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-shiori/shiori/pull/450 **Author:** [@hulb](https://github.com/hulb) **Created:** 7/10/2022 **Status:** ✅ Merged **Merged:** 9/30/2022 **Merged by:** [@fmartingr](https://github.com/fmartingr) **Base:** `master` ← **Head:** `feat/pass-ctx-to-db` --- ### 📝 Commits (2) - [`4c74da2`](https://github.com/go-shiori/shiori/commit/4c74da2e036bda6fa3b9cd8fa0e0a9308aa6b72a) refactor:pass ctx to db layer, return err instead of recover panic - [`b33aeed`](https://github.com/go-shiori/shiori/commit/b33aeed12e81740e942cf21a64240f91d39dee9b) Merge branch 'feat/pass-ctx-to-db' into master-new ### 📊 Changes **20 files changed** (+875 additions, -702 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+2 -1) 📝 `internal/cmd/add.go` (+2 -2) 📝 `internal/cmd/check.go` (+2 -2) 📝 `internal/cmd/delete.go` (+1 -1) 📝 `internal/cmd/export.go` (+1 -1) 📝 `internal/cmd/import.go` (+9 -3) 📝 `internal/cmd/open.go` (+1 -1) 📝 `internal/cmd/pocket.go` (+9 -3) 📝 `internal/cmd/print.go` (+1 -1) 📝 `internal/cmd/root.go` (+12 -11) 📝 `internal/cmd/update.go` (+4 -4) 📝 `internal/cmd/utils.go` (+1 -1) 📝 `internal/database/database.go` (+41 -17) 📝 `internal/database/mysql.go` (+214 -205) 📝 `internal/database/pg.go` (+217 -201) 📝 `internal/database/sqlite.go` (+278 -215) 📝 `internal/webserver/handler-api-ext.go` (+15 -6) 📝 `internal/webserver/handler-api.go` (+52 -22) 📝 `internal/webserver/handler-ui.go` (+12 -4) 📝 `internal/webserver/utils.go` (+1 -1) </details> ### 📄 Description This PR makes a refactor of ways to handle error in db layer. I don't think it's proper to panic when there is an error in db actions. And every db action should be executed with a context passed by the caller. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 23:34:51 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#600
No description provided.