From fba86b6b545981ea76fee26f0d454ea08a02b27d Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Mon, 21 Apr 2025 07:00:15 +0800 Subject: [PATCH] Tiny improve error message (#5526) --- python/sglang/lang/backend/runtime_endpoint.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/sglang/lang/backend/runtime_endpoint.py b/python/sglang/lang/backend/runtime_endpoint.py index 1cd3d5246..afda890a7 100644 --- a/python/sglang/lang/backend/runtime_endpoint.py +++ b/python/sglang/lang/backend/runtime_endpoint.py @@ -324,7 +324,11 @@ class RuntimeEndpoint(BaseBackend): def _assert_success(self, res): if res.status_code != 200: - raise RuntimeError(res.json()) + try: + content = res.json() + except json.JSONDecodeError: + content = res.text + raise RuntimeError(content) def compute_normalized_prompt_logprobs(input_logprobs):