Skip to content

StrError

Description

Get last error using an error number.

Parameters

Name Direction Description
eno in Unique error number descriptor.
err_str out Error string will be stored in this.

Success

Returns err_str with the error description appended.

Failure

Aborts via ValidateStr if err_str is NULL or uninitialised (*err_str is left in its pre-call state).

Usage example (Cross-references)

Usage examples (Cross-references)
            StrAppendFmt(&UNPL(m), __VA_ARGS__);                                                                           \
            StrInitStack(UNPL(syserr), 256) {                                                                              \
                StrError(UNPL(sys_eno), &UNPL(syserr));                                                                    \
                StrAppendFmt(&UNPL(m), " : {}", UNPL(syserr));                                                             \
            }                                                                                                              \
            StrAppendFmt(&UNPL(m), __VA_ARGS__);                                                                           \
            StrInitStack(UNPL(syserr), 256) {                                                                              \
                StrError(UNPL(sys_eno), &UNPL(syserr));                                                                    \
                StrAppendFmt(&UNPL(m), " : {}", UNPL(syserr));                                                             \
            }                                                                                                              \
            StrAppendFmt(&UNPL(m), __VA_ARGS__);                                                                           \
            StrInitStack(UNPL(syserr), 256) {                                                                              \
                StrError(UNPL(sys_eno), &UNPL(syserr));                                                                    \
                StrAppendFmt(&UNPL(m), " : {}", UNPL(syserr));                                                             \
            }                                                                                                              \
    // on the first byte via `reserve_vec`, regardless of platform; it only
    // stayed hidden because the errno paths that reach here are rare.
    Str *StrError(i32 eno, Str *err_str) {
        ValidateStr(err_str);
        StrClear(err_str);
Last updated on