Skip to content

Commit b0a3190

Browse files
committed
Update README to include error handling information
1 parent c168d6d commit b0a3190

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Compresses a string.
4242
**Returns:**
4343
- `string`: The compressed data
4444

45+
**Raises:**
46+
- Raises a Lua error if memory allocation fails: `"Failed to allocate memory"`
47+
- Raises a Lua error if compression fails: `"Failed to compress: <error_name>"` (where `<error_name>` is the ZSTD error name)
48+
4549
### `zstd.decompress(data)`
4650
Decompresses a string.
4751

@@ -51,6 +55,13 @@ Decompresses a string.
5155
**Returns:**
5256
- `string`: The decompressed data.
5357

58+
**Raises:**
59+
- Raises a Lua error if the content size is invalid: `"Invalid content size"`
60+
- Raises a Lua error if memory allocation fails: `"Failed to allocate memory"`
61+
- Raises a Lua error if decompression context creation fails: `"Failed to create decompression context"`
62+
- Raises a Lua error if memory reallocation fails: `"Failed to reallocate memory"`
63+
- Raises a Lua error if decompression fails: `"Failed to decompress: <error_name>"` (where `<error_name>` is the ZSTD error name)
64+
5465
## Maintainer Notes
5566

5667
The Zstd library is assembled into a single file `zstd.c` using the script `./build/single_file_libs/create_single_file_library.sh` that comes with the library's source code. Also, to work around build issues on Android due to the qsort_r function, the dictBuilder/* lines are commented out in the `zstd-in.c` file.

0 commit comments

Comments
 (0)