Chore: Differentiate the ErrOrgNotFound error messages (#64131)
* Better org not found error messages
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user