Commit e274a527 authored by Steven Murray's avatar Steven Murray
Browse files

DriveCatalogueLabelSession now sends error string to client

parent 6d3161ff
......@@ -95,10 +95,15 @@ void castor::tape::tapeserver::daemon::DriveCatalogueLabelSession::
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::DriveCatalogueLabelSession::
sessionFailed() {
castor::exception::Exception ex;
try {
legacymsg::writeTapeReplyMsg(m_netTimeout, m_labelCmdConnection,
ex.code(), ex.getMessage().str());
if(!m_labelErrors.empty()) {
const castor::exception::Exception &labelEx = m_labelErrors.front();
legacymsg::writeTapeReplyMsg(m_netTimeout, m_labelCmdConnection,
labelEx.code(), labelEx.getMessage().str());
} else {
legacymsg::writeTapeReplyMsg(m_netTimeout, m_labelCmdConnection,
SEINTERNAL, "Unknown error");
}
} catch(castor::exception::Exception &we) {
log::Param params[] = {log::Param("message", we.getMessage().str())};
m_log(LOG_ERR, "Failed to send failure reply-message to label command",
......
......@@ -88,11 +88,10 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
params);
return MARK_DRIVE_AS_UP;
} catch(castor::exception::Exception &ne) {
m_tapeserver.labelError(m_request.drive, ne);
} catch(castor::exception::Exception &ex) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to label tape: " << ne.getMessage().str();
// Send details of exception to tapeserverd and then rethrow
m_tapeserver.labelError(m_request.drive, ex);
throw ex;
}
}
......
......@@ -861,17 +861,14 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
rqst.force());
return labelsession.execute();
} catch(castor::exception::Exception &ne) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to run label session: " << ne.getMessage().str();
throw ex;
throw ne;
} catch(std::exception &se) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to run label session: " << se.what();
ex.getMessage() << se.what();
throw ex;
} catch(...) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to run label session"
": Caught an unknown exception";
ex.getMessage() << "Caught an unknown exception";
throw ex;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment