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

Error string describing last error.

Failure

Returns NULL if err_str is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    Str *StrError(i32 eno, Str *err_str) {
        ValidateStr(err_str);
        Allocator *alloc     = err_str->allocator;
            Str              syserr;
            StrInitStack(syserr, &err_alloc, SYS_ERROR_STR_MAX_LENGTH, {
                StrError(errno, &syserr);
                LOG_ERROR("Failed to get localtime : {}", syserr);
            });
            Str syserr_;                                                                                                   \
            StrInitStack(syserr_, &log_alloc_, 256, {                                                                      \
                StrError(errno, &syserr_);                                                                                 \
                StrWriteFmt(&m_, " : {}", syserr_);                                                                        \
            });                                                                                                            \
            Str syserr_;                                                                                                   \
            StrInitStack(syserr_, &log_alloc_, 256, {                                                                      \
                StrError(errno, &syserr_);                                                                                 \
                StrWriteFmt(&m_, " : {}", syserr_);                                                                        \
            });                                                                                                            \
            Str syserr_;                                                                                                   \
            StrInitStack(syserr_, &log_alloc_, 256, {                                                                      \
                StrError(errno, &syserr_);                                                                                 \
                StrWriteFmt(&m_, " : {}", syserr_);                                                                        \
            });                                                                                                            \
Last updated on