mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:23:06 +02:00
fix asset loading with error changes
This commit is contained in:
parent
9c53f40fbe
commit
50a05df721
3 changed files with 18 additions and 24 deletions
|
@ -482,7 +482,7 @@ void AssetServer::loadMappingsFromFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "Failed to read mapping file at" << mapFilePath << "- assignment with not continue.";
|
qCritical() << "Failed to read mapping file at" << mapFilePath << "- assignment will not continue.";
|
||||||
setFinished(true);
|
setFinished(true);
|
||||||
} else {
|
} else {
|
||||||
qInfo() << "No existing mappings loaded from file since no file was found at" << mapFilePath;
|
qInfo() << "No existing mappings loaded from file since no file was found at" << mapFilePath;
|
||||||
|
|
|
@ -37,7 +37,7 @@ void AssetRequest::start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case we haven't parsed a valid hash, return an error now
|
// in case we haven't parsed a valid hash, return an error now
|
||||||
if (isValidHash(_hash)) {
|
if (!isValidHash(_hash)) {
|
||||||
_error = InvalidHash;
|
_error = InvalidHash;
|
||||||
_state = Finished;
|
_state = Finished;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void AssetRequest::start() {
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
assetClient->getAssetInfo(_hash, [this](bool responseReceived, AssetServerError serverError, AssetInfo info) {
|
assetClient->getAssetInfo(_hash, [this](bool responseReceived, AssetServerError serverError, AssetInfo info) {
|
||||||
_info = info;
|
_info = info;
|
||||||
|
|
||||||
if (!responseReceived) {
|
if (!responseReceived) {
|
||||||
_error = NetworkError;
|
_error = NetworkError;
|
||||||
} else if (serverError != AssetServerError::NoError) {
|
} else if (serverError != AssetServerError::NoError) {
|
||||||
|
|
|
@ -58,15 +58,6 @@ void AssetResourceRequest::requestMappingForPath(const AssetPath& path) {
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
_assetMappingRequest = assetClient->createGetMappingRequest(path);
|
_assetMappingRequest = assetClient->createGetMappingRequest(path);
|
||||||
|
|
||||||
// if we get a nullptr for createGetMappingRequest assume that there is no currently available asset-server
|
|
||||||
if (!_assetMappingRequest) {
|
|
||||||
_result = ServerUnavailable;
|
|
||||||
_state = Finished;
|
|
||||||
|
|
||||||
emit finished();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we'll hear about the result of the get mapping request
|
// make sure we'll hear about the result of the get mapping request
|
||||||
connect(_assetMappingRequest, &GetMappingRequest::finished, this, [this, path](GetMappingRequest* request){
|
connect(_assetMappingRequest, &GetMappingRequest::finished, this, [this, path](GetMappingRequest* request){
|
||||||
Q_ASSERT(_state == InProgress);
|
Q_ASSERT(_state == InProgress);
|
||||||
|
@ -80,24 +71,27 @@ void AssetResourceRequest::requestMappingForPath(const AssetPath& path) {
|
||||||
requestHash(request->getHash());
|
requestHash(request->getHash());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MappingRequest::NotFound:
|
default: {
|
||||||
// no result for the mapping request, set error to not found
|
switch (request->getError()) {
|
||||||
_result = NotFound;
|
case MappingRequest::NotFound:
|
||||||
|
// no result for the mapping request, set error to not found
|
||||||
|
_result = NotFound;
|
||||||
|
break;
|
||||||
|
case MappingRequest::NetworkError:
|
||||||
|
// didn't hear back from the server, mark it unavailable
|
||||||
|
_result = ServerUnavailable;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_result = Error;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// since we've failed we know we are finished
|
// since we've failed we know we are finished
|
||||||
_state = Finished;
|
_state = Finished;
|
||||||
emit finished();
|
emit finished();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
// these are unexpected errors for a GetMappingRequest object
|
|
||||||
_result = Error;
|
|
||||||
|
|
||||||
// since we've failed we know we are finished
|
|
||||||
_state = Finished;
|
|
||||||
emit finished();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_assetMappingRequest->deleteLater();
|
_assetMappingRequest->deleteLater();
|
||||||
|
|
Loading…
Reference in a new issue