ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
errors.h File Reference

Go to the source code of this file.

Functions

size_t browser_error_snapshot (void)
int browser_error_code (size_t index)
const char * browser_error_message (size_t index)
const char * browser_error_file (size_t index)
const char * browser_error_full_file (size_t index)
const char * browser_error_function (size_t index)
int browser_error_line (size_t index)
void browser_error_dismiss (void)

Function Documentation

◆ browser_error_code()

int browser_error_code ( size_t index)

Definition at line 21 of file src/web/common/errors.c.

21 {
22 const asciichat_error_context_t *frame = browser_error_at(index);
23 return frame ? frame->code : ASCIICHAT_OK;
24}
@ ASCIICHAT_OK
Definition error_codes.h:50
static bool size_t index
Definition queries.h:10

References ASCIICHAT_OK, asciichat_error_context_t::code, and index.

Referenced by ErrorBinding::frame().

◆ browser_error_dismiss()

void browser_error_dismiss ( void )

Definition at line 56 of file src/web/common/errors.c.

56 {
58 browser_error_count = 0;
59}
void errno_clear_all(void)

References errno_clear_all().

Referenced by ErrorBinding::dismiss().

◆ browser_error_file()

const char * browser_error_file ( size_t index)

Definition at line 31 of file src/web/common/errors.c.

31 {
32 const asciichat_error_context_t *frame = browser_error_at(index);
33 return frame && frame->file ? extract_project_relative_path(frame->file, ASCIICHAT_OWNED_SOURCE_DIRS) : "";
34}
const char * extract_project_relative_path(const char *file, const char *const *owned_dirs)
Extract a path relative to the source root embedded by CMake.
Definition path.c:137

References extract_project_relative_path(), asciichat_error_context_t::file, and index.

Referenced by ErrorBinding::frame().

◆ browser_error_full_file()

const char * browser_error_full_file ( size_t index)

Definition at line 36 of file src/web/common/errors.c.

36 {
37#ifdef NDEBUG
38 (void)index;
39 return "";
40#else
41 const asciichat_error_context_t *frame = browser_error_at(index);
42 return frame && frame->file ? frame->file : "";
43#endif
44}

References asciichat_error_context_t::file, and index.

Referenced by ErrorBinding::frame().

◆ browser_error_function()

const char * browser_error_function ( size_t index)

Definition at line 46 of file src/web/common/errors.c.

46 {
47 const asciichat_error_context_t *frame = browser_error_at(index);
48 return frame && frame->function ? frame->function : "";
49}

References asciichat_error_context_t::function, and index.

Referenced by ErrorBinding::frame().

◆ browser_error_line()

int browser_error_line ( size_t index)

Definition at line 51 of file src/web/common/errors.c.

51 {
52 const asciichat_error_context_t *frame = browser_error_at(index);
53 return frame ? frame->line : 0;
54}

References index, and asciichat_error_context_t::line.

Referenced by ErrorBinding::frame().

◆ browser_error_message()

const char * browser_error_message ( size_t index)

Definition at line 26 of file src/web/common/errors.c.

26 {
27 const asciichat_error_context_t *frame = browser_error_at(index);
28 return frame ? frame->context_message : "";
29}

References asciichat_error_context_t::context_message, and index.

Referenced by ErrorBinding::frame().

◆ browser_error_snapshot()

size_t browser_error_snapshot ( void )

Browser-facing C interface implemented in errors.c.

Definition at line 11 of file src/web/common/errors.c.

11 {
12 asciichat_errno_snapshot_t snapshot = errno_snapshot(thread_current_id(), browser_error_frames, ASCIICHAT_ERRNO_MAX_DEPTH);
13 browser_error_count = snapshot.copied;
14 return snapshot.total;
15}
asciichat_errno_snapshot_t errno_snapshot(uint64_t id, asciichat_error_context_t *out, size_t capacity)
#define ASCIICHAT_ERRNO_MAX_DEPTH

References ASCIICHAT_ERRNO_MAX_DEPTH, asciichat_errno_snapshot_t::copied, errno_snapshot(), and asciichat_errno_snapshot_t::total.

Referenced by ErrorBinding::snapshot().