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

Module errno

Overview

The errno module is typically used within a function or within a Lua program, in association with a module whose functions can return operating-system errors, such as fio.

Index

Below is a list of all errno functions.

Name

Use

errno()

Get an error number for the last OS-related function

errno.strerror()

Get an error message for the corresponding error number

errno()

Return an error number for the last operating-system-related function, or 0. To invoke it, simply say errno(), without the module name.

Return type

integer

strerror([code])

Return a string, given an error number. The string will contain the text of the conventional error message for the current operating system. If code is not supplied, the error message will be for the last operating-system-related function, or 0.

Parameters:

  • code (integer) — number of an operating-system error

Return type

string

Example:

This function displays the result of a call to fio.open() which causes error 2 (errno.ENOENT). The display includes the error number, the associated error string, and the error name.

tarantool> function f()         >   local fio = require('fio')         >   local errno = require('errno')         >   fio.open('no_such_file')         >   print('errno() = ' .. errno())         >   print('errno.strerror() = ' .. errno.strerror())         >   local t = getmetatable(errno).__index         >   for k, v in pairs(t) do         >     if v == errno() then         >       print('errno() constant = ' .. k)         >     end         >   end         > end---...tarantool> f()errno() = 2errno.strerror() = No such file or directoryerrno() constant = ENOENT---...

To see all possible error names stored in the errno metatable, say getmetatable(errno) (output abridged):

tarantool> getmetatable(errno)---- __newindex: 'function: 0x41666a38'  __call: 'function: 0x41666890'  __index:  ENOLINK: 67  EMSGSIZE: 90  EOVERFLOW: 75  ENOTCONN: 107  EFAULT: 14  EOPNOTSUPP: 95  EEXIST: 17  ENOSR: 63  ENOTSOCK: 88  EDESTADDRREQ: 89  <...>...