mirror of
https://github.com/openai/codex.git
synced 2026-05-02 20:32:04 +03:00
migrating execpolicy -> execpolicy-legacy and execpolicy2 -> execpolicy (#6956)
This commit is contained in:
96
codex-rs/execpolicy-legacy/src/error.rs
Normal file
96
codex-rs/execpolicy-legacy/src/error.rs
Normal file
@@ -0,0 +1,96 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::arg_matcher::ArgMatcher;
|
||||
use crate::arg_resolver::PositionalArg;
|
||||
use serde_with::DisplayFromStr;
|
||||
use serde_with::serde_as;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[serde_as]
|
||||
#[derive(Debug, Eq, PartialEq, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum Error {
|
||||
NoSpecForProgram {
|
||||
program: String,
|
||||
},
|
||||
OptionMissingValue {
|
||||
program: String,
|
||||
option: String,
|
||||
},
|
||||
OptionFollowedByOptionInsteadOfValue {
|
||||
program: String,
|
||||
option: String,
|
||||
value: String,
|
||||
},
|
||||
UnknownOption {
|
||||
program: String,
|
||||
option: String,
|
||||
},
|
||||
UnexpectedArguments {
|
||||
program: String,
|
||||
args: Vec<PositionalArg>,
|
||||
},
|
||||
DoubleDashNotSupportedYet {
|
||||
program: String,
|
||||
},
|
||||
MultipleVarargPatterns {
|
||||
program: String,
|
||||
first: ArgMatcher,
|
||||
second: ArgMatcher,
|
||||
},
|
||||
RangeStartExceedsEnd {
|
||||
start: usize,
|
||||
end: usize,
|
||||
},
|
||||
RangeEndOutOfBounds {
|
||||
end: usize,
|
||||
len: usize,
|
||||
},
|
||||
PrefixOverlapsSuffix {},
|
||||
NotEnoughArgs {
|
||||
program: String,
|
||||
args: Vec<PositionalArg>,
|
||||
arg_patterns: Vec<ArgMatcher>,
|
||||
},
|
||||
InternalInvariantViolation {
|
||||
message: String,
|
||||
},
|
||||
VarargMatcherDidNotMatchAnything {
|
||||
program: String,
|
||||
matcher: ArgMatcher,
|
||||
},
|
||||
EmptyFileName {},
|
||||
LiteralValueDidNotMatch {
|
||||
expected: String,
|
||||
actual: String,
|
||||
},
|
||||
InvalidPositiveInteger {
|
||||
value: String,
|
||||
},
|
||||
MissingRequiredOptions {
|
||||
program: String,
|
||||
options: Vec<String>,
|
||||
},
|
||||
SedCommandNotProvablySafe {
|
||||
command: String,
|
||||
},
|
||||
ReadablePathNotInReadableFolders {
|
||||
file: PathBuf,
|
||||
folders: Vec<PathBuf>,
|
||||
},
|
||||
WriteablePathNotInWriteableFolders {
|
||||
file: PathBuf,
|
||||
folders: Vec<PathBuf>,
|
||||
},
|
||||
CannotCheckRelativePath {
|
||||
file: PathBuf,
|
||||
},
|
||||
CannotCanonicalizePath {
|
||||
file: String,
|
||||
#[serde_as(as = "DisplayFromStr")]
|
||||
error: std::io::ErrorKind,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user