summaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorMatteo Bigoi <bigo@crisidev.org>2020-11-22 17:16:40 +0000
committerGitHub <noreply@github.com>2020-11-22 17:16:40 +0000
commitc197df7df4045abdc2d4e8077781249dd83dbdd1 (patch)
treeacac6348029eef9c6fc67adf45cd87755117679a /src/util.rs
parent1c5bc43ace2c32f37dfc6a308d8b6d687c2dc860 (diff)
downloadssh2-rs-c197df7df4045abdc2d4e8077781249dd83dbdd1.zip
Handle more precise SFTP error codes (#203)
* Handle more precise SFTP error codes * Allow set-env in macos github action * Bump to 0.9 since the Error interface has changed, hence this is a breaking change
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.rs b/src/util.rs
index 96cb1c5..258aa59 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -1,7 +1,7 @@
use std::borrow::Cow;
use std::path::Path;
-use {raw, Error};
+use {raw, Error, ErrorCode};
#[cfg(unix)]
pub fn path2bytes(p: &Path) -> Result<Cow<[u8]>, Error> {
@@ -16,7 +16,7 @@ pub fn path2bytes(p: &Path) -> Result<Cow<[u8]>, Error> {
.map(|s| s.as_bytes())
.ok_or_else(|| {
Error::new(
- raw::LIBSSH2_ERROR_INVAL,
+ ErrorCode::Session(raw::LIBSSH2_ERROR_INVAL),
"only unicode paths on windows may be used",
)
})
@@ -40,7 +40,7 @@ pub fn path2bytes(p: &Path) -> Result<Cow<[u8]>, Error> {
fn check(b: Cow<[u8]>) -> Result<Cow<[u8]>, Error> {
if b.iter().any(|b| *b == 0) {
Err(Error::new(
- raw::LIBSSH2_ERROR_INVAL,
+ ErrorCode::Session(raw::LIBSSH2_ERROR_INVAL),
"path provided contains a 0 byte",
))
} else {