Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
SFTP.cpp
Go to the documentation of this file.
1#include "joedb/ssh/SFTP.h"
2
3namespace joedb
4{
5 namespace ssh
6 {
7 ///////////////////////////////////////////////////////////////////////////
8 char const * const SFTP_Allocation::error_message[] =
9 ///////////////////////////////////////////////////////////////////////////
10 {
11 "OK",
12 "end of file",
13 "no such file",
14 "permission denied",
15 "failure",
16 "bad message",
17 "no connection",
18 "connection lost",
19 "op unsupported",
20 "invalid handle",
21 "no such path",
22 "file already exists",
23 "write protect",
24 "no media"
25 };
26
27 ///////////////////////////////////////////////////////////////////////////
28 void SFTP_Allocation::throw_error(const char *message) const
29 ///////////////////////////////////////////////////////////////////////////
30 {
31 const int error = sftp_get_error(sftp);
32
33 char const * const error_string =
34 error < int(sizeof(error_message) / sizeof(*error_message)) ?
35 error_message[error] :
36 "unknown error";
37
38 throw Exception
39 (
40 std::string(message) + std::string(error_string)
41 );
42 }
43 }
44}
void throw_error(const char *message="sftp error: ") const
Definition SFTP.cpp:28
Definition Blob.h:7