@@ -172,23 +172,28 @@ void SessionHandler<Session>::Login(authentication::UserCredentials&& user_crede
172
172
Identity session_location{ detail::GetSessionLocation (*user_credentials.keyword ,
173
173
*user_credentials.pin ) };
174
174
LOG (kVerbose ) << " Session location: " << HexSubstr (session_location);
175
- auto versions_future =
176
- session_getter_->data_getter ().GetVersions (MutableData::Name (session_location));
177
- LOG (kVerbose ) << " Waiting for versions_future" ;
178
- auto versions (versions_future.get ());
179
- LOG (kVerbose ) << " GetVersions from session location succeeded" ;
180
- assert (versions.size () == 1U );
181
- // TODO(Fraser#5#): 2014-04-17 - Get more than just the latest version - possibly just for the
182
- // case where the latest one fails. Or just throw, but add 'int version_number' to this
183
- // function's signature where 0 == most recent, 1 == second newest, etc.
184
- auto encrypted_serialised_session_future (session_getter_->data_getter ().Get (versions.at (0 ).id ));
185
- auto encrypted_serialised_session (encrypted_serialised_session_future.get ());
186
- LOG (kVerbose ) << " Get encrypted_serialised_session succeeded" ;
187
- session_ = maidsafe::make_unique<Session>(
188
- detail::DecryptSession<Session>(user_credentials, encrypted_serialised_session));
189
- current_session_version_ = versions.at (0 );
190
- user_credentials_ = std::move (user_credentials);
191
- session_getter_.reset ();
175
+ try {
176
+ auto versions_future =
177
+ session_getter_->data_getter ().GetVersions (MutableData::Name (session_location));
178
+ LOG (kVerbose ) << " Waiting for versions_future" ;
179
+ auto versions (versions_future.get ());
180
+ LOG (kVerbose ) << " GetVersions from session location succeeded" ;
181
+ assert (versions.size () == 1U );
182
+ // TODO(Fraser#5#): 2014-04-17 - Get more than just the latest version - possibly just for the
183
+ // case where the latest one fails. Or just throw, but add 'int version_number' to this
184
+ // function's signature where 0 == most recent, 1 == second newest, etc.
185
+ auto encrypted_serialised_session_future (session_getter_->data_getter ().Get (versions.at (0 ).id ));
186
+ auto encrypted_serialised_session (encrypted_serialised_session_future.get ());
187
+ LOG (kVerbose ) << " Get encrypted_serialised_session succeeded" ;
188
+ session_ = maidsafe::make_unique<Session>(
189
+ detail::DecryptSession<Session>(user_credentials, encrypted_serialised_session));
190
+ current_session_version_ = versions.at (0 );
191
+ user_credentials_ = std::move (user_credentials);
192
+ session_getter_.reset ();
193
+ } catch (const std::exception& e) {
194
+ LOG (kError ) << " Failed to Login. Error: " << boost::diagnostic_information (e);
195
+ throw ;
196
+ }
192
197
}
193
198
194
199
template <typename Session>
0 commit comments