Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display exception message when failing process request #51

Merged
merged 1 commit into from
Nov 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/NFS3Prog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int CNFS3Prog::Process(IInputStream *pInStream, IOutputStream *pOutStream, Proce
&CNFS3Prog::ProcedureCOMMIT
};

nfsstat3 stat;
nfsstat3 stat = NULL;

struct tm current;
time_t now;
Expand All @@ -253,15 +253,22 @@ int CNFS3Prog::Process(IInputStream *pInStream, IOutputStream *pOutStream, Proce

try {
stat = (this->*pf[pParam->nProc])();
} catch (const std::runtime_error& re) {
m_nResult = PRC_FAIL;
PrintLog("Runtime error: ");
PrintLog(re.what());
} catch (const std::exception& ex) {
m_nResult = PRC_FAIL;
PrintLog("Exception: ");
PrintLog(ex.what());
} catch (...) {
m_nResult = PRC_FAIL;
PrintLog("Unknown failure: Possible memory corruption");
}

PrintLog(" ");

if (m_nResult == PRC_FAIL) { //input data is truncated
PrintLog("fail");
} else {
if (stat != NULL) {
switch (stat) {
case NFS3_OK:
PrintLog("OK");
Expand Down