mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
some more fixes
This commit is contained in:
@@ -116,8 +116,8 @@ export class FavoritesApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async isFavoriteWithRetry(nodeId: string, data) {
|
||||
let isFavorite;
|
||||
async isFavoriteWithRetry(nodeId: string, data: { expect: boolean }) {
|
||||
let isFavorite: boolean;
|
||||
try {
|
||||
const favorite = async () => {
|
||||
isFavorite = await this.isFavorite(nodeId);
|
||||
@@ -129,7 +129,7 @@ export class FavoritesApi extends RepoApi {
|
||||
};
|
||||
return await Utils.retryCall(favorite);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.isFavoriteWithRetry.name}`, error);
|
||||
// this.handleError(`${this.constructor.name} ${this.isFavoriteWithRetry.name}`, error);
|
||||
}
|
||||
return isFavorite;
|
||||
}
|
||||
@@ -166,7 +166,8 @@ export class FavoritesApi extends RepoApi {
|
||||
};
|
||||
return await Utils.retryCall(favoriteFiles);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForApi.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ export class NodesApi extends RepoApi {
|
||||
return Promise.resolve(isLocked);
|
||||
}
|
||||
}
|
||||
await Utils.retryCall(locked, data.retry);
|
||||
return await Utils.retryCall(locked, data.retry);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.isFileLockedWriteWithRetry.name}`, error);
|
||||
}
|
||||
|
||||
@@ -77,11 +77,12 @@ export class QueriesApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForSites.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForSites.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForFilesAndFolders(searchTerm: string, data: any) {
|
||||
async waitForFilesAndFolders(searchTerm: string, data: { expect: number }) {
|
||||
try {
|
||||
const nodes = async () => {
|
||||
const totalItems = (await this.findNodes(searchTerm)).list.pagination.totalItems;
|
||||
@@ -94,7 +95,8 @@ export class QueriesApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(nodes);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForFilesAndFolders.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForFilesAndFolders.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +50,18 @@ export abstract class RepoApi {
|
||||
|
||||
protected handleError(message: string, response: any) {
|
||||
console.log(`\n--- ${message} error :`);
|
||||
console.log('\t>>> Status: ', response.status);
|
||||
console.log('\t>>> Text: ', response.response.text);
|
||||
console.log('\t>>> Method: ', response.response.error.method);
|
||||
console.log('\t>>> Path: ', response.response.error.path);
|
||||
if ( response.status ) {
|
||||
try {
|
||||
console.log('\t>>> Status: ', response.status);
|
||||
console.log('\t>>> Text: ', response.response.text);
|
||||
console.log('\t>>> Method: ', response.response.error.method);
|
||||
console.log('\t>>> Path: ', response.response.error.path);
|
||||
} catch {
|
||||
console.log('\t>>> ', response);
|
||||
}
|
||||
}
|
||||
else console.log('\t>>> ', response);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export class SearchApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async waitForApi(username, data) {
|
||||
async waitForApi(username: string, data: { expect: number }) {
|
||||
try {
|
||||
const recentFiles = async () => {
|
||||
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
||||
@@ -109,11 +109,12 @@ export class SearchApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(recentFiles);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForApi.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForNodes(searchTerm: string, data) {
|
||||
async waitForNodes(searchTerm: string, data: { expect: number }) {
|
||||
try {
|
||||
const nodes = async () => {
|
||||
const totalItems = (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
|
||||
@@ -126,7 +127,8 @@ export class SearchApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(nodes);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForNodes.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForNodes.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,8 @@ export class SharedLinksApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(sharedFiles);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForApi.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,8 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForApi.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,8 @@ export class TrashcanApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(deletedFiles);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.waitForApi.name}`, error);
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user