fix: handleApiError() with name
This commit is contained in:
parent
d3609ac691
commit
728d5262ab
@ -122,7 +122,7 @@ class PCloudImpl {
|
|||||||
ignoredErrorCodes.add(PCloudApiError.PCloudApiErrorCodes.COMPONENT_OF_PARENT_DIRECTORY_DOES_NOT_EXIST.getValue());
|
ignoredErrorCodes.add(PCloudApiError.PCloudApiErrorCodes.COMPONENT_OF_PARENT_DIRECTORY_DOES_NOT_EXIST.getValue());
|
||||||
ignoredErrorCodes.add(PCloudApiError.PCloudApiErrorCodes.INVALID_FILE_OR_FOLDER_NAME.getValue());
|
ignoredErrorCodes.add(PCloudApiError.PCloudApiErrorCodes.INVALID_FILE_OR_FOLDER_NAME.getValue());
|
||||||
ignoredErrorCodes.add(PCloudApiError.PCloudApiErrorCodes.FILE_OR_FOLDER_NOT_FOUND.getValue());
|
ignoredErrorCodes.add(PCloudApiError.PCloudApiErrorCodes.FILE_OR_FOLDER_NOT_FOUND.getValue());
|
||||||
handleApiError(ex, ignoredErrorCodes);
|
handleApiError(ex, ignoredErrorCodes, node.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ class PCloudImpl {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch(ApiError ex) {
|
} catch(ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, folder.getName());
|
||||||
throw new FatalBackendException(ex);
|
throw new FatalBackendException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ class PCloudImpl {
|
|||||||
.execute();
|
.execute();
|
||||||
return PCloudNodeFactory.folder(folder.getParent(), createdFolder);
|
return PCloudNodeFactory.folder(folder.getParent(), createdFolder);
|
||||||
} catch (ApiError ex) {
|
} catch (ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, folder.getName());
|
||||||
throw new FatalBackendException(ex);
|
throw new FatalBackendException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ class PCloudImpl {
|
|||||||
return PCloudNodeFactory.from(target.getParent(), client().moveFile(source.getPath(), target.getPath()).execute());
|
return PCloudNodeFactory.from(target.getParent(), client().moveFile(source.getPath(), target.getPath()).execute());
|
||||||
}
|
}
|
||||||
} catch(ApiError ex) {
|
} catch(ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, source.getName() + " / " + target.getName());
|
||||||
throw new FatalBackendException(ex);
|
throw new FatalBackendException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ class PCloudImpl {
|
|||||||
.createFile(file.getParent().getPath(), file.getName(), pCloudDataSource, new Date(), listener, uploadOptions) //
|
.createFile(file.getParent().getPath(), file.getName(), pCloudDataSource, new Date(), listener, uploadOptions) //
|
||||||
.execute();
|
.execute();
|
||||||
} catch (ApiError ex) {
|
} catch (ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, file.getName());
|
||||||
throw new FatalBackendException(ex);
|
throw new FatalBackendException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ class PCloudImpl {
|
|||||||
remoteFile = client().loadFile(file.getPath()).execute().asFile();
|
remoteFile = client().loadFile(file.getPath()).execute().asFile();
|
||||||
cacheKey = Optional.of(remoteFile.fileId() + remoteFile.hash());
|
cacheKey = Optional.of(remoteFile.fileId() + remoteFile.hash());
|
||||||
} catch(ApiError ex) {
|
} catch(ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, file.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
File cachedFile = diskLruCache.get(cacheKey.get());
|
File cachedFile = diskLruCache.get(cacheKey.get());
|
||||||
@ -288,7 +288,7 @@ class PCloudImpl {
|
|||||||
|
|
||||||
client().download(fileLink, sink, listener).execute();
|
client().download(fileLink, sink, listener).execute();
|
||||||
} catch(ApiError ex) {
|
} catch(ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, file.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sharedPreferencesHandler.useLruCache() && encryptedTmpFile.isPresent() && cacheKey.isPresent()) {
|
if (sharedPreferencesHandler.useLruCache() && encryptedTmpFile.isPresent() && cacheKey.isPresent()) {
|
||||||
@ -311,7 +311,7 @@ class PCloudImpl {
|
|||||||
.deleteFile(node.getPath()).execute();
|
.deleteFile(node.getPath()).execute();
|
||||||
}
|
}
|
||||||
} catch(ApiError ex) {
|
} catch(ApiError ex) {
|
||||||
handleApiError(ex);
|
handleApiError(ex, node.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,11 +341,11 @@ class PCloudImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleApiError(ApiError ex) throws BackendException {
|
private void handleApiError(ApiError ex) throws BackendException {
|
||||||
handleApiError(ex, null);
|
handleApiError(ex, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleApiError(ApiError ex, Set<Integer> errorCodes) throws BackendException {
|
private void handleApiError(ApiError ex, String name) throws BackendException {
|
||||||
handleApiError(ex, errorCodes, null);
|
handleApiError(ex, null, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleApiError(ApiError ex, Set<Integer> errorCodes, String name) throws BackendException {
|
private void handleApiError(ApiError ex, Set<Integer> errorCodes, String name) throws BackendException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user