envoyproxy / envoyproxy/envoy

remove the exception throwing in filterState data fetching, maybe use statusOr instead.

Open
#20,792 5 comments 0 reactions 0 assignees View on GitHub
area/xds enhancement no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
428

Description

*Title*: remove the exception throwing in filterState data fetching, maybe use statusOr instead.

*Description*:
https://github.com/envoyproxy/envoy/pull/20791 changed the rule of exception throwing in Envoy data-plane, let's remove the exception-throwing code in FilterState. Presumably return StatusOr or Status to indicate the error instead.

```
void FilterStateImpl::setData(absl::string_view data_name, std::shared_ptr data,
FilterState::StateType state_type, FilterState::LifeSpan life_span) {
if (life_span > life_span_) {
if (hasDataWithNameInternally(data_name)) {
throw EnvoyException(
"FilterState::setData called twice with conflicting life_span on the same data_name.");
}
maybeCreateParent(ParentAccessMode::ReadWrite);
parent_->setData(data_name, data, state_type, life_span);
return;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.