forked from redpanda-data/redpanda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cloud_storage: Handle nested benign exception
If a nested exception is thrown where either the inner or outer exception is abort requested or gate closed, this is logged as a debug level error. If the nested exception is of any other kind, an error level log is generated.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2023 Redpanda Data, Inc. | ||
* | ||
* Licensed as a Redpanda Enterprise file under the Redpanda Community | ||
* License (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* https://github.com/redpanda-data/redpanda/blob/master/licenses/rcl.md | ||
*/ | ||
|
||
#include "cloud_storage_clients/util.h" | ||
|
||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_CASE(test_nested_exception) { | ||
{ | ||
auto inner = std::make_exception_ptr(ss::abort_requested_exception{}); | ||
auto outer = std::make_exception_ptr(ss::gate_closed_exception{}); | ||
ss::nested_exception ex{inner, outer}; | ||
BOOST_REQUIRE( | ||
cloud_storage_clients::util::has_abort_or_gate_close_exception(ex)); | ||
} | ||
|
||
{ | ||
auto inner = std::make_exception_ptr(std::bad_alloc{}); | ||
auto outer = std::make_exception_ptr(ss::gate_closed_exception{}); | ||
ss::nested_exception ex{inner, outer}; | ||
BOOST_REQUIRE( | ||
cloud_storage_clients::util::has_abort_or_gate_close_exception(ex)); | ||
} | ||
|
||
{ | ||
auto inner = std::make_exception_ptr(std::invalid_argument{""}); | ||
auto outer = std::make_exception_ptr( | ||
ss::no_sharded_instance_exception{}); | ||
ss::nested_exception ex{inner, outer}; | ||
BOOST_REQUIRE( | ||
!cloud_storage_clients::util::has_abort_or_gate_close_exception(ex)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters