summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-11 00:35:40 +0530
committerBobby <[email protected]>2026-03-11 00:35:40 +0530
commit65761a45925de90464b1df330c55f737d1273c90 (patch)
tree5c21c1ae823cccbc96971e8fee04051e4934ed8a
parentb023fc7c2c0024387a10ca32656b063e33db4c53 (diff)
downloadpagoda-65761a45925de90464b1df330c55f737d1273c90.tar.xz
pagoda-65761a45925de90464b1df330c55f737d1273c90.zip
fix: handle error case in FindDistrictSiteByURL function
-rw-r--r--shrine/repositories/district.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/shrine/repositories/district.go b/shrine/repositories/district.go
index 4772895..8a6b7cf 100644
--- a/shrine/repositories/district.go
+++ b/shrine/repositories/district.go
@@ -24,7 +24,10 @@ func FindDistrictSiteByRef(ref string) (*models.DistrictSite, error) {
func FindDistrictSiteByURL(url string) (*models.DistrictSite, error) {
var site models.DistrictSite
err := database.DB.Where("url = ?", url).First(&site).Error
- return &site, err
+ if err != nil {
+ return nil, err
+ }
+ return &site, nil
}
func ListDistrictSites(pagination meta.Pagination, district string, tag string, search string) ([]models.DistrictSite, int64) {