File: mg_error_data.md

package info (click to toggle)
civetweb 1.16%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,576 kB
  • sloc: ansic: 32,463; cpp: 1,374; sh: 480; javascript: 204; makefile: 119; php: 11; perl: 6; python: 3
file content (34 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Civetweb API Reference

### `struct mg_error_data;`

### Fields

| Field | Type | Description |
| :--- | :--- | :--- |
|**`code`**|`unsigned *`| Error code (see `MG_ERROR_DATA_CODE_*`). |
|**`code_sub`**|`unsigned *`| Error sub code, depending on error code. |
|**`text`**|`char *`| A text buffer to store the error text. |
|**`text_buffer_size`**|`size_t`| Size of the text buffer. |

### Description

The structure `mg_error_data` is used to return error information.
The `code` number will be set to one of the `MG_ERROR_DATA_CODE_*` values defined in civetweb.h.

The meaning of the `code_sub` number will depend on the value of `code`.
The `code_sub` member is experimental and may change in future versions.

The optional pointer `text` can be used to provide storage for a textual error message.
The size of the provided `text` pointer must be set in `text_buffer_size`.
If no textual error message is required and no buffer is probided, `text_buffer_size` must be set to 0.

Currently `struct mg_error_data` is used by the functions [`mg_start2()`](mg_start.md), [`mg_start_domain2();`](mg_start_domain2.md), [`mg_connect_client2();`](mg_connect_client2.md) and [`mg_get_response2();`](mg_get_response2.md).

### See Also

* [`mg_start2();`](mg_start2.md)
* [`mg_start_domain2();`](mg_start_domain2.md)
* [`mg_connect_client2();`](mg_connect_client2.md)
* [`mg_get_response2();`](mg_get_response2.md)
* [`struct mg_init_data;`](mg_init_data.md)