[Frontend][Core] Standardize request error handling with VLLMError hierarchy (#49665)
Signed-off-by: Zach Zhu <zzqshu@126.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import aiohttp
|
||||
import pytest
|
||||
|
||||
from vllm.entrypoints.serve.utils.error_response import create_error_response
|
||||
from vllm.exceptions import VLLMUnprocessableEntityError
|
||||
from vllm.exceptions import VLLMClientError, VLLMUnprocessableEntityError
|
||||
from vllm.multimodal.media import MediaConnector
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ class TestVLLMUnprocessableEntityError:
|
||||
assert "parameter=image_url" in str(exc)
|
||||
assert "value=https://example.com/image.jpg" in str(exc)
|
||||
|
||||
def test_is_value_error_subclass(self):
|
||||
def test_is_client_error_subclass(self):
|
||||
exc = VLLMUnprocessableEntityError("Test")
|
||||
assert isinstance(exc, ValueError)
|
||||
assert isinstance(exc, VLLMClientError)
|
||||
|
||||
|
||||
class TestMediaConnectorErrorHandling:
|
||||
|
||||
@@ -8,6 +8,7 @@ import numpy as np
|
||||
import pytest
|
||||
|
||||
from vllm.config import ModelConfig
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
from vllm.multimodal import MULTIMODAL_REGISTRY
|
||||
from vllm.multimodal.processing.context import InputProcessingContext
|
||||
from vllm.multimodal.processing.processor import (
|
||||
@@ -931,7 +932,11 @@ def test_limit_mm_per_prompt_apply(model_id, num_images, limit, is_valid):
|
||||
else:
|
||||
mm_data = {"image": [image] * num_images}
|
||||
|
||||
exc_ctx = nullcontext() if is_valid else pytest.raises(ValueError, match="At most")
|
||||
exc_ctx = (
|
||||
nullcontext()
|
||||
if is_valid
|
||||
else pytest.raises(VLLMValidationError, match="At most")
|
||||
)
|
||||
|
||||
with exc_ctx:
|
||||
processor(
|
||||
|
||||
Reference in New Issue
Block a user