added try - catch in api and handleError methods

This commit is contained in:
Adina Parpalita
2019-10-22 13:14:57 +03:00
parent 227e05e3f9
commit e8ed183a44
13 changed files with 201 additions and 189 deletions

View File

@@ -38,7 +38,7 @@ export class CommentsApi extends RepoApi {
await this.apiAuth();
return await this.commentsApi.listComments(nodeId);
} catch (error) {
console.log('--- comments api getNodeComments catch error: ', error);
this.handleError(`${this.constructor.name} ${this.getNodeComments.name}`, error);
return null;
}
}
@@ -48,7 +48,7 @@ export class CommentsApi extends RepoApi {
await this.apiAuth();
return await this.commentsApi.createComment(nodeId, { "content": comment });
} catch (error) {
console.log('--- comments api addComment catch error: ', error);
this.handleError(`${this.constructor.name} ${this.addComment.name}`, error);
return null;
}
}
@@ -58,7 +58,7 @@ export class CommentsApi extends RepoApi {
await this.apiAuth();
return await this.commentsApi.createComment(nodeId, comment);
} catch (error) {
console.log('--- comments api addComments catch error: ', error);
this.handleError(`${this.constructor.name} ${this.addComments.name}`, error);
return null;
}
}