strop_workspace/addr/
error.rs1#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
6pub enum AddressError {
7 #[error("file URIs must use an empty or localhost authority")]
8 NonLocalFileAuthority,
9 #[error("container locations require a canonical full container ID and absolute path")]
10 InvalidContainerLocation,
11 #[error("resource URI must use file://, ssh:// or container:")]
12 UnsupportedResourceUri,
13 #[error("remote locations use the form `ssh://[user@]host[:port]/absolute/path`")]
14 NotSshUri,
15 #[error(
16 "SSH locations cannot carry a password (`user:pass@`); authenticate with keys or an agent instead"
17 )]
18 PasswordInUri,
19 #[error("empty username before `@`")]
20 EmptyUser,
21 #[error("host is empty")]
22 EmptyHost,
23 #[error("port must be 1-65535 written in digits, e.g. `:2222`")]
24 InvalidPort,
25 #[error(
26 "refusing an option-shaped username/host (leading `-` or any `=`): SSH would read it as an option"
27 )]
28 OptionShapedEndpoint,
29 #[error("IPv6 hosts need brackets, e.g. `ssh://[2001:db8::1]:22/var/log/app.log`")]
30 UnbracketedIpv6,
31 #[error("bracketed IPv6 host is missing its closing `]`")]
32 UnclosedIpv6,
33 #[error("only `:port` may follow a bracketed IPv6 host")]
34 JunkAfterIpv6,
35 #[error("{literal:?} is not a valid IPv6 address")]
36 InvalidIpv6 { literal: String },
37 #[error("{literal:?} looks like an IPv4 address but is not a valid one")]
38 InvalidIpv4 { literal: String },
39 #[error(
40 "remote path is missing: the location must end in an absolute path like `/var/log/app.log`"
41 )]
42 AbsentPath,
43 #[error(
44 "SSH locations carry no query string or fragment; percent-encode those bytes in the path instead (`?` -> `%3F`, `#` -> `%23`)"
45 )]
46 QueryOrFragment,
47 #[error("percent escapes need two hexadecimal digits, e.g. `%20`")]
48 MalformedPercentEscape,
49 #[error("path cannot contain a NUL byte")]
50 NulInPath,
51 #[error("path contains a byte that must be percent-encoded (a space is `%20`)")]
52 UnencodedPathByte,
53 #[cfg(not(unix))]
54 #[error("the decoded path bytes are not representable as a native filename on this platform")]
55 UnrepresentablePath,
56 #[error("username/host may only contain ASCII letters, digits and `-._+`")]
57 InvalidAuthorityCharacter,
58 #[error(
59 "an endpoint carries no path: this value names files, so parse it as a location or file instead"
60 )]
61 PathOnEndpoint,
62 #[error(
63 "the path begins with `~` (a home query), which is not a canonical file; a session must expand it first"
64 )]
65 UnresolvedHome,
66 #[error("a resource path is absolute: it must start with `/`")]
67 RelativePath,
68}