Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Partially drop anyhow from crate::runtimes:wapc #424

Merged
merged 5 commits into from
Jan 30, 2024

Conversation

viccuad
Copy link
Member

@viccuad viccuad commented Jan 29, 2024

Description

Relates to #377.

  • Partially implement thiserror a type and its enums for crate::runtimes::wapc.
    It is still missing crate::runtimes::wapc::callback which will follow up later. The definition of the callback function type is more complicated, and I wanted to have a full codepath for the errors first.
  • Finish migration to thiserror for crate::runtimes::rego.

I recommend reviewing per commit, yet note that for protocol_version() there's a stopgap change between commits.

Note: protocol_version() is only consumed by kwctl but not yet by policy-server, opened kubewarden/policy-server#642.

Test

CI, integration tests.

Additional Information

Tradeoff

Potential improvement

Create src/runtimes/wapc/errors.rs with needed errors so far.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Change the `crates::runtimes::wapc::errors` module to public, as this new
`policyEvaluatorError` consumes and wraps `WapcRuntimeError` in some errors.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
@viccuad viccuad requested a review from a team as a code owner January 29, 2024 11:59
@viccuad viccuad self-assigned this Jan 29, 2024
use crate::policy_evaluator::RegoPolicyExecutionMode;
use crate::policy_evaluator_builder::EpochDeadlines;

use super::errors::{RegoRuntimeError, Result};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use crate and avoid super as per code conventions

Copy link
Member Author

@viccuad viccuad Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true! done in 220620b

@viccuad viccuad merged commit 625ca84 into kubewarden:main Jan 30, 2024
5 checks passed
@viccuad viccuad deleted the drop-anyhow branch January 30, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants