Return generic result for get operations that includes error messages

This commit is contained in:
Tim Wojtulewicz 2025-01-22 17:00:38 -07:00
parent 4695060d75
commit f1a7376e0a
27 changed files with 83 additions and 53 deletions

View file

@ -37,13 +37,16 @@ event zeek_init() {
get_res = Storage::get(b, key, F);
Storage::close_backend(b);
if ( get_res?$error )
Reporter::error(get_res$error);
# Test attempting to use the closed handle.
put_res = Storage::put(b, [$key="a", $value="b", $overwrite=F]);
get_res = Storage::get(b, "a");
erase_res = Storage::erase(b, "a");
print(fmt("results of trying to use closed handle: get: %d, put: %d, erase: %d",
get_res, put_res, erase_res));
get_res?$val, put_res, erase_res));
# Test failing to open the handle and test closing an invalid handle.
opts$open_fail = T;