# HG changeset patch # User Mads Kiilerich # Date 2020-03-06 18:47:29 # Node ID 5661a603cf50ebbd362fd98705e3c40c9d88950c # Parent 37ec17c1344c09ef96346211efd8fa00fcefca7c cleanup: improve exception logging from validators There were no point in logging the whole raw exception with stacktrace - it is more relevant to log something helpful Catching of Exception is however bad. Also, it seems odd what ValidPerms is doing with "update permissions" in the validator. diff --git a/kallithea/model/validators.py b/kallithea/model/validators.py --- a/kallithea/model/validators.py +++ b/kallithea/model/validators.py @@ -409,8 +409,8 @@ def ValidCloneUri(): if url and url != value.get('clone_uri_hidden'): try: is_valid_repo_uri(repo_type, url, make_ui()) - except Exception: - log.exception('URL validation failed') + except Exception as e: + log.warning('validation of clone URL %r failed: %s', url, e) msg = self.message('clone_uri', state) raise formencode.Invalid(msg, value, state, error_dict=dict(clone_uri=msg) @@ -588,8 +588,8 @@ def ValidPerms(type_='repo'): .filter(UserGroup.users_group_active == True) \ .filter(UserGroup.users_group_name == k).one() - except Exception: - log.exception('Updated permission failed') + except Exception as e: + log.warning('Error validating %s permission %s', t, k) msg = self.message('perm_new_member_type', state) raise formencode.Invalid(msg, value, state, error_dict=dict(perm_new_member_name=msg)