mirror of
https://github.com/openai/codex.git
synced 2026-05-02 18:37:01 +00:00
feat: make ConstraintError an enum (#8330)
This will make it easier to test for expected errors in unit tests since we can compare based on the field values rather than the message (which might change over time). See https://github.com/openai/codex/pull/8298 for an example. It also ensures more consistency in the way a `ConstraintError` is constructed.
This commit is contained in:
@@ -2275,12 +2275,12 @@ async fn approvals_popup_shows_disabled_presets() {
|
||||
chat.config.approval_policy =
|
||||
Constrained::new(AskForApproval::OnRequest, |candidate| match candidate {
|
||||
AskForApproval::OnRequest => Ok(()),
|
||||
_ => Err(ConstraintError {
|
||||
message: "this message should be printed in the description".to_string(),
|
||||
}),
|
||||
_ => Err(ConstraintError::invalid_value(
|
||||
candidate.to_string(),
|
||||
"this message should be printed in the description",
|
||||
)),
|
||||
})
|
||||
.expect("construct constrained approval policy");
|
||||
|
||||
chat.open_approvals_popup();
|
||||
|
||||
let width = 80;
|
||||
@@ -2311,12 +2311,12 @@ async fn approvals_popup_navigation_skips_disabled() {
|
||||
chat.config.approval_policy =
|
||||
Constrained::new(AskForApproval::OnRequest, |candidate| match candidate {
|
||||
AskForApproval::OnRequest => Ok(()),
|
||||
_ => Err(ConstraintError {
|
||||
message: "disabled preset".to_string(),
|
||||
}),
|
||||
_ => Err(ConstraintError::invalid_value(
|
||||
candidate.to_string(),
|
||||
"[on-request]",
|
||||
)),
|
||||
})
|
||||
.expect("construct constrained approval policy");
|
||||
|
||||
chat.open_approvals_popup();
|
||||
|
||||
// The approvals popup is the active bottom-pane view; drive navigation via chat handle_key_event.
|
||||
|
||||
Reference in New Issue
Block a user