#40 - ensure return is a JSON with 'detail' field in case of the error
This commit is contained in:
@@ -26,7 +26,7 @@ from amqp.adapter.data_parser import AMQDataParser
|
||||
from amqp.adapter.data_response_factory import AMQResponseFactory
|
||||
from amqp.adapter.cleverthis_service_adapter import CleverThisServiceAdapter, AMQMessage
|
||||
from amqp.config.amq_configuration import AMQConfiguration
|
||||
from amqp.model.model import AMQResponse
|
||||
from amqp.model.model import AMQResponse, AMQErrorMessage
|
||||
from amqp.service.amq_service import AMQService
|
||||
|
||||
|
||||
@@ -220,12 +220,12 @@ class CleverSwarmAmqpAdapter(CleverThisServiceAdapter):
|
||||
loop=self.loop,
|
||||
)
|
||||
|
||||
return AMQResponseFactory.of(
|
||||
return AMQResponseFactory.of_error_message(
|
||||
message.id,
|
||||
404,
|
||||
"text/plain",
|
||||
str(f"Destination location [{message.path}] does not exists").encode(
|
||||
"utf-8"
|
||||
AMQErrorMessage(
|
||||
404,
|
||||
"Not Found",
|
||||
f"Destination location [{message.path}] does not exists",
|
||||
),
|
||||
message.trace_info,
|
||||
)
|
||||
@@ -293,12 +293,12 @@ class CleverSwarmAmqpAdapter(CleverThisServiceAdapter):
|
||||
loop=self.loop,
|
||||
)
|
||||
|
||||
return AMQResponseFactory.of(
|
||||
return AMQResponseFactory.of_error_message(
|
||||
message.id,
|
||||
404,
|
||||
"text/plain",
|
||||
str(f"Destination location [{message.path}] does not exists").encode(
|
||||
"utf-8"
|
||||
AMQErrorMessage(
|
||||
404,
|
||||
"Not Found",
|
||||
f"Destination location [{message.path}] does not exists",
|
||||
),
|
||||
message.trace_info,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user