The @weintek/libc/string
module can be used to convert a given error code
to a textual description.
Note:
- The modules under
@weintek/libc
(e.g.,errno
,stdio
,string
,unistd
) are heavily influenced by the design of C standard library. - The module is availabe when JS object/action is run on Local HMI)
Methods
(static) strerror(errnum) → {String}
- Since:
- EasyBuilder Pro V6.09.01
- See:
This method returns a textual description of the error code errnum
.
Example
const cerrno = await import('@weintek/libc/errno');
const cstring = await import('@weintek/libc/string');
const errCode = cerrno.getErrno();
const errMessage = cstring.strerror(errCode);
console.log(`Error: ${errMessage}`);
Parameters:
Name | Type | Description |
---|---|---|
errnum |
Number | An error code retrieved by |
Returns:
Returns a descriptive string corresponding to the error code errnum
.
- Type
- String