Commit ce72ebdf authored by Ricardo Calheiros de Miranda Cosme's avatar Ricardo Calheiros de Miranda Cosme
Browse files

[OPENBUS-90]

* Simplificação/consistência no mecanismo de reportar erro durante a chamada de openbus->connect().



git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/trunk@84726 ae0415b3-e90b-0410-900d-d0be9363c56b
parent baf28994
......@@ -132,12 +132,16 @@ namespace openbus {
services::IAccessControlService* Openbus::connect(String host, unsigned short port, String user, String password, \
services::Credential* aCredential, services::Lease* aLease) {
services::IAccessControlService* acs = getACS(host, port);
if (!acs->loginByPassword(user, password, aCredential, aLease)) {
return 0;
} else {
credentialManager->setValue(aCredential);
return acs;
try {
services::IAccessControlService* acs = getACS(host, port);
if (!acs->loginByPassword(user, password, aCredential, aLease)) {
throw "Par usuario/senha nao validado.";
} else {
credentialManager->setValue(aCredential);
return acs;
}
} catch (const char* errmsg) {
throw errmsg;
}
}
......
......@@ -40,10 +40,7 @@ int main(int argc, char** argv) {
services::IAccessControlService* acs;
try {
acs = openbus->connect(HOST, (unsigned short) PORT, USER, PASSWORD, credential, lease);
if (!acs) {
throw "Servico de controle de acesso localizado, porem o par usuario/senha nao foi validado.";
}
} catch (const char* errmsg) {
} catch (const char* errmsg) {
cout << "** Nao foi possivel se conectar ao barramento." << endl << errmsg << endl;
exit(-1);
}
......
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