Chore: Differentiate the ErrOrgNotFound error messages (#64131)

* Better org not found error messages
This commit is contained in:
Sofia Papagiannaki
2023-03-06 09:57:46 +02:00
committed by GitHub
parent 1aadafe7d8
commit fde96c91c1
6 changed files with 19 additions and 14 deletions
+6 -2
View File
@@ -215,8 +215,12 @@ func UseOrgFromContextParams(c *contextmodel.ReqContext) (int64, error) {
orgID, err := strconv.ParseInt(web.Params(c.Req)[":orgId"], 10, 64)
// Special case of macaron handling invalid params
if orgID == 0 || err != nil {
return 0, org.ErrOrgNotFound
if err != nil {
return 0, org.ErrOrgNotFound.Errorf("failed to get organization from context: %w", err)
}
if orgID == 0 {
return 0, org.ErrOrgNotFound.Errorf("empty org ID")
}
return orgID, nil