@weintek/libc/string
The @weintek/libc/string module provides a method for converting error codes to human-readable messages.
Influenced by the C standard library.
Note: Available when a Custom Model script runs on a local HMI.
Import
js
const cstring = await import('@weintek/libc/string');Functions
strerror(errnum)
Returns a textual description of the error code.
See cppreference.com.
| Name | Type | Description |
|---|---|---|
errnum | Number | An error code retrieved from getErrno(). |
Returns: String — A human-readable description of the error.
Example
js
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}`);