Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

box.error.set()

box.error.set(error_object)

Since: 2.4.1

Set the specified error as the last system error explicitly. This error is returned by /reference/reference_lua/box_error/last.

Parameters:

  • error_object (error_object) — an error object

Example

-- 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...--]]