Обновлена 15 сентября 2026 г. в 08:55
box.error.set()
Начиная с: 2.4.1
Явно устанавливает указанную ошибку в качестве последней системной ошибки. Эта ошибка возвращается функцией box.error.last().
Параметры:
error_object(error_object) — объект ошибки
Пример
-- Create two errors --local error1 = box.error.new({ code = 500, reason = 'Custom error 1' })local error2 = box.error.new({ code = 505, reason = 'Custom error 2' })-- Raise the first error --box.error(error1)--[[---- error: Custom error 1...--]]-- Get the last error --box.error.last()--[[---- Custom error 1...--]]-- Set the second error as the last error --box.error.set(error2)--[[---...--]]-- Get the last error --box.error.last()--[[---- Custom error 2...--]]