浏览代码

[sentry] Do not error out when the group does not exist in Sentry

There is no error code to detect this, just looking for the error
in the exception.
Romain Rigaux 10 年之前
父节点
当前提交
1c0e1e3
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      apps/security/src/security/api/hive.py

+ 5 - 1
apps/security/src/security/api/hive.py

@@ -63,7 +63,11 @@ def list_sentry_roles_by_group(request):
     result['message'] = ''
     result['message'] = ''
     result['status'] = 0
     result['status'] = 0
   except Exception, e:
   except Exception, e:
-    result['message'] = unicode(str(e), "utf8")
+    if "couldn't be retrieved." in str(e):
+      result['roles'] = []
+      result['status'] = 0
+    else:
+      result['message'] = unicode(str(e), "utf8")
 
 
   return JsonResponse(result)
   return JsonResponse(result)