Skip to content

Commit 8595869

Browse files
Added handling for unauth error (#5115)
(cherry picked from commit 99ebad5)
1 parent d0a9cef commit 8595869

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

detection_rules/devtools.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,15 @@ def raw_permalink(raw_link: str) -> str:
10501050
raise raise_client_error(
10511051
"Gist not found: verify the gist_id exists and the token has access to it", exc=exc
10521052
) from exc
1053+
if exc.response.status_code == requests.status_codes.codes.unauthorized:
1054+
text = json.loads(exc.response.text).get(
1055+
"message", "verify the token is valid and has the necessary permissions"
1056+
)
1057+
error_message = f"Unauthorized: {text}"
1058+
raise raise_client_error(
1059+
error_message,
1060+
exc=exc,
1061+
) from exc
10531062
raise
10541063

10551064
response_data = response.json()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "detection_rules"
3-
version = "1.4.2"
3+
version = "1.4.3"
44
description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine."
55
readme = "README.md"
66
requires-python = ">=3.12"

0 commit comments

Comments
 (0)