Skip to content

Commit

Permalink
↪️ Merge pull request #228 from OiCMudkips/fix_audit_highlight_valuee…
Browse files Browse the repository at this point in the history
…rror_crash

Don't crash audit when highlighter fails in audit
  • Loading branch information
OiCMudkips authored Aug 21, 2019
2 parents 17918d8 + 49256ff commit cba0446
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion detect_secrets/core/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,10 @@ def _get_secret_with_context(
filename,
)

snippet.highlight_line(raw_secret_value)
try:
snippet.highlight_line(raw_secret_value)
except ValueError:
raise SecretNotFoundOnSpecifiedLineError(secret['line_number'])
except SecretNotFoundOnSpecifiedLineError:
if not force:
raise
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/pre_commit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def raise_exception_if_baseline_file_is_unstaged(filename):
'--name-only',
],
).split()
except subprocess.CalledProcessError:
except subprocess.CalledProcessError: # pragma: no cover
# Since we don't pipe stderr, we get free logging through git.
raise ValueError

Expand Down

0 comments on commit cba0446

Please sign in to comment.