diff options
| author | Bobby <[email protected]> | 2026-03-11 00:35:40 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-11 00:35:40 +0530 |
| commit | 65761a45925de90464b1df330c55f737d1273c90 (patch) | |
| tree | 5c21c1ae823cccbc96971e8fee04051e4934ed8a | |
| parent | b023fc7c2c0024387a10ca32656b063e33db4c53 (diff) | |
| download | pagoda-65761a45925de90464b1df330c55f737d1273c90.tar.xz pagoda-65761a45925de90464b1df330c55f737d1273c90.zip | |
fix: handle error case in FindDistrictSiteByURL function
| -rw-r--r-- | shrine/repositories/district.go | 5 |
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) { |
