Skip to content

Commit 5ba49df

Browse files
committed
alter exception handling
1 parent 69a4d41 commit 5ba49df

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

src/core/include/cesium/omniverse/CesiumIonSession.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CesiumIonSession {
2323
const CesiumAsync::AsyncSystem& asyncSystem,
2424
std::shared_ptr<CesiumAsync::IAssetAccessor> pAssetAccessor,
2525
std::string ionServerUrl,
26-
/*std::string ionApiUrl,*/
26+
std::string ionApiUrl,
2727
int64_t ionApplicationId);
2828
~CesiumIonSession() = default;
2929
CesiumIonSession(const CesiumIonSession&) = delete;

src/core/src/CesiumIonSession.cpp

+6-17
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ CesiumIonSession::CesiumIonSession(
3737
, _loadTokensQueued(false)
3838
, _authorizeUrl()
3939
, _ionServerUrl(std::move(ionServerUrl))
40-
/* , _ionApiUrl(std::move(ionApiUrl)) */
41-
, _ionApplicationId(ionApplicationId) {}
40+
, _ionApiUrl(std::move(ionApiUrl))
41+
, _ionApplicationId(ionApplicationId) {
42+
}
4243

4344
void CesiumIonSession::connect() {
44-
4545
if (this->isConnecting() || this->isConnected() || this->isResuming()) {
4646
return;
4747
}
@@ -86,7 +86,7 @@ void CesiumIonSession::connect() {
8686
this->_authorizeUrl = url;
8787
},
8888
this->_appData.value(),
89-
_ionServerUrl,
89+
_ionApiUrl,
9090
CesiumUtility::Uri::resolve(_ionServerUrl, "oauth"));
9191
}
9292

@@ -97,9 +97,6 @@ void CesiumIonSession::connect() {
9797
this->_isConnecting = false;
9898
this->_connection = std::move(connection);
9999

100-
// TODO: how to update filed in OmniIonServer?
101-
// CesiumForUnity::CesiumIonServer server = session.server();
102-
103100
Settings::AccessToken token;
104101
token.ionApiUrl = _ionApiUrl;
105102
token.accessToken = this->_connection.value().getAccessToken();
@@ -142,8 +139,6 @@ void CesiumIonSession::resume() {
142139

143140
this->_isResuming = true;
144141

145-
this->_connection.reset(); //DEBUG
146-
147142
// Verify that the connection actually works.
148143
this->ensureAppDataLoaded()
149144
.thenInMainThread([this, accessToken](bool loadedAppData) {
@@ -346,26 +341,20 @@ CesiumAsync::Future<bool> CesiumIonSession::ensureAppDataLoaded() {
346341
return CesiumIonClient::Connection::appData(
347342
this->_asyncSystem,
348343
this->_pAssetAccessor,
349-
this->_ionApiUrl) // .ToStlString()?
344+
this->_ionApiUrl)
350345
.thenInMainThread([this](CesiumIonClient::Response<CesiumIonClient::ApplicationData>&& applicationData) {
351346
CesiumAsync::Promise<bool> promise = this->_asyncSystem.createPromise<bool>();
352347

353348
this->_appData = applicationData.value;
354349
if (!applicationData.value.has_value()) {
355-
// UnityEngine::Debug::LogError(System::String(fmt::format(
356-
// "Failed to obtain ion server application data: {}",
357-
// applicationData.errorMessage)));
358350
promise.resolve(false);
359351
} else {
360352
promise.resolve(true);
361353
}
362354

363355
return promise.getFuture();
364356
})
365-
.catchInMainThread([this](std::exception&& e) {
366-
// logResponseErrors(e);
367-
(void)e; // get around unused formal parameter error
368-
357+
.catchInMainThread([this]([[maybe_unused]]std::exception&& e) {
369358
return this->_asyncSystem.createResolvedFuture(false);
370359
});
371360
}

src/core/src/OmniIonServer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "cesium/omniverse/UsdUtil.h"
66

77
#include <CesiumUsdSchemas/ionServer.h>
8+
#include <string>
89

910
namespace cesium::omniverse {
1011

@@ -17,6 +18,7 @@ OmniIonServer::OmniIonServer(Context* pContext, const pxr::SdfPath& path)
1718
getIonServerUrl(),
1819
getIonServerApiUrl(),
1920
getIonServerApplicationId())) {
21+
2022
_session->resume();
2123
}
2224

0 commit comments

Comments
 (0)