flows: fix FlowNonApplicableException not being Sentry Ignored

This commit is contained in:
Jens Langhammer 2021-01-27 09:57:18 +01:00
parent 2798a3edc9
commit 55bcc254c1
2 changed files with 5 additions and 3 deletions

View file

@ -1,9 +1,11 @@
"""flow exceptions""" """flow exceptions"""
from authentik.lib.sentry import SentryIgnoredException
class FlowNonApplicableException(BaseException):
class FlowNonApplicableException(SentryIgnoredException):
"""Flow does not apply to current user (denied by policy).""" """Flow does not apply to current user (denied by policy)."""
class EmptyFlowException(BaseException): class EmptyFlowException(SentryIgnoredException):
"""Flow has no stages.""" """Flow has no stages."""

View file

@ -120,7 +120,7 @@ class FlowPlanner:
engine.build() engine.build()
result = engine.result result = engine.result
if not result.passing: if not result.passing:
raise FlowNonApplicableException(result.messages) raise FlowNonApplicableException(",".join(result.messages))
# User is passing so far, check if we have a cached plan # User is passing so far, check if we have a cached plan
cached_plan_key = cache_key(self.flow, user) cached_plan_key = cache_key(self.flow, user)
cached_plan = cache.get(cached_plan_key, None) cached_plan = cache.get(cached_plan_key, None)