ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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 22 of file src/web/common/errors.c.

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

References ASCIICHAT_OK, asciichat_error_context_t::code, and index.

◆ browser_error_dismiss()

void browser_error_dismiss ( void )

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

57 {
59 browser_error_count = 0;
60}
void errno_clear_all(void)

References errno_clear_all().

Referenced by EMSCRIPTEN_BINDINGS().

◆ browser_error_file()

const char * browser_error_file ( size_t index)

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

32 {
33 const asciichat_error_context_t *frame = browser_error_at(index);
34 return frame && frame->file ? extract_project_relative_path(frame->file, ASCIICHAT_OWNED_SOURCE_DIRS) : "";
35}
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.

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

◆ browser_error_full_file()

const char * browser_error_full_file ( size_t index)

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

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

References asciichat_error_context_t::file, and index.

◆ browser_error_function()

const char * browser_error_function ( size_t index)

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

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

References asciichat_error_context_t::function, and index.

◆ browser_error_line()

int browser_error_line ( size_t index)

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

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

References index, and asciichat_error_context_t::line.

◆ browser_error_message()

const char * browser_error_message ( size_t index)

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

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

References asciichat_error_context_t::context_message, and index.

◆ 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 {
13 errno_snapshot(thread_current_id(), browser_error_frames, ASCIICHAT_ERRNO_MAX_DEPTH);
14 browser_error_count = snapshot.copied;
15 return snapshot.total;
16}
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 EMSCRIPTEN_BINDINGS().