Skip to content

Commit 49887e9

Browse files
Merge pull request #1120 from GitGuardian/specific-apitoken-error-message
fix: update error messages to specify "Invalid GitGuardian API key"
2 parents c3d4753 + 3e399fc commit 49887e9

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

ggshield/core/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def check_client_api_key(client: GGClient, required_scopes: set[TokenScope]) ->
108108
# None means success
109109
pass
110110
elif response.status_code == 401:
111-
raise APIKeyCheckError(client.base_uri, "Invalid API key.")
111+
raise APIKeyCheckError(client.base_uri, "Invalid GitGuardian API key.")
112112
elif response.status_code == 404:
113113
raise UnexpectedError(
114114
"The server returned a 404 error. Check your instance URL settings.",

tests/unit/cmd/auth/test_login.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
}
5555
)
5656

57-
INVALID_TOKEN_RESPONSE = create_json_response({"detail": "Invalid API key."}, 401)
57+
INVALID_TOKEN_RESPONSE = create_json_response(
58+
{"detail": "Invalid GitGuardian API key."}, 401
59+
)
5860

5961
METADATA_ENDPOINT = "/v1/metadata"
6062

tests/unit/verticals/secret/test_secret_scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_scanner_skips_unscannable_files(client, fs, cache, unscannable_type: st
170170

171171

172172
def test_handle_scan_error_api_key():
173-
detail = Detail("Invalid API key.")
173+
detail = Detail("Invalid GitGuardian API key.")
174174
detail.status_code = 401
175175
with pytest.raises(click.UsageError):
176176
handle_scan_chunk_error(detail, [])

0 commit comments

Comments
 (0)