This commit is contained in:
narawat lamaiin
2024-05-09 13:08:31 +07:00
parent 78d69194e9
commit a4e7dee5bf
2 changed files with 98 additions and 94 deletions

View File

@@ -164,24 +164,25 @@ function virtualWineCustomerChatbox(a::T1, input::T2
)
attempt = 0
while attempt <= 5
while true
attempt += 1
try
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
response = result[:response]
if attempt <= 5
try
result = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
response = result[:response]
return (response[:text], response[:select], response[:reward], response[:isterminal])
catch e
io = IOBuffer()
showerror(io, e)
errorMsg = String(take!(io))
st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace()))
println("")
@warn "Error occurred: $errorMsg\n$st"
println("")
end
return (response[:text], response[:select], response[:reward], response[:isterminal])
catch e
io = IOBuffer()
showerror(io, e)
errorMsg = String(take!(io))
st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace()))
println("")
@warn "Error occurred: $errorMsg\n$st"
println("")
end
if attempt > 5
else
error("virtualWineCustomerChatbox failed to get a response")
end
end