Subject: Re: Error reporting

Re: Error reporting

From: Will Cosgrove <>
Date: Thu, 6 Dec 2018 09:53:21 -0800

Reporting the exact error sounds good to me. To my knowledge there is no reason not to report it.

I would prefer if there was no additional English string formatting on the error message so it would be easier to localize for applications who want to do that. In your example simply reporting the string from the server "scp: ~/test.txt: No such file or directoryā€¯ with the correct error code seems ideal.



> On Dec 5, 2018, at 10:36 PM, George Nachman <> wrote:
> I've noticed that libssh2 does not expose as much detail about errors as I would like. For example, when scp'ing a file that does not exist, it reports an error of "Failed to recv file" through libssh2_session_last_error(). The real error was reported by the server, and was "scp: ~/test.txt: No such file or directory". My users are confused by the former and I would like to show them the latter.
> My questions are:
> 1. Is there a good reason not to expose the text the server sends? At least in the case of the "Failed to recv file" error it wouldn't be difficult to add it to the error string. But perhaps that buffer can't be malloced or clients expect that particular string back. Or maybe there's some security angle I'm not seeing.
> 2. Would you accept a patch to fix this issue? I think I'd like to see something along the lines of this:
> Failed to recv file. Server reported: "scp: ~/test.txt: No such file or directory".
> Thanks,
> George
> _______________________________________________
> libssh2-devel

Received on 2018-12-06