[Trunk|Library]: Fix error logs in entitiesAutoComplete.component, fetchEntitiesClasses, helper.component, staticAutoComplete.component.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54870 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-02-19 15:26:59 +00:00
parent ac20e5ae64
commit 1a7bb8df37
10 changed files with 202 additions and 64 deletions

View File

@ -261,7 +261,11 @@ export class EntitiesAutocompleteComponent {
this.selected.push( data[0]); this.selected.push( data[0]);
this.showInput = false; this.showInput = false;
}, },
err => console.log("An error occured")); err => {
//console.log("An error occured"));
this.handleError("Error getting results of type: "+this.entityType+" with id: "+this.selectedValue, err);
}
);
} }
} }
@ -282,4 +286,7 @@ export class EntitiesAutocompleteComponent {
} }
} }
private handleError(message: string, error) {
console.error("Autocomplete (component): "+message, error);
}
} }

View File

@ -1,10 +1,12 @@
import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import { ErrorCodes} from '../../utils/properties/errorCodes'; import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties'; import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class'; import {StringUtils} from '../../utils/string-utils.class';
export class FetchDataproviders { export class FetchDataproviders {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -19,6 +21,7 @@ export class FetchDataproviders {
constructor ( private _searchDataprovidersService: SearchDataprovidersService ) { constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
} }
@ -55,7 +58,7 @@ export class FetchDataproviders {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -69,6 +72,9 @@ export class FetchDataproviders {
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }
*/
this.handleError("Error getting content providers for keyword: "+keyword, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -91,7 +97,7 @@ export class FetchDataproviders {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
if(err.status == '404') { if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND; this.searchUtils.status = this.errorCodes.NOT_FOUND;
@ -99,7 +105,9 @@ export class FetchDataproviders {
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting content providers with parameters: "+parameters + " for Home", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -121,7 +129,7 @@ export class FetchDataproviders {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -134,7 +142,9 @@ export class FetchDataproviders {
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting content providers for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -154,7 +164,7 @@ export class FetchDataproviders {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -167,7 +177,9 @@ export class FetchDataproviders {
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting number of content providers for keyword: "+keyword, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -208,7 +220,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number,
this.oldTotalResults = this.searchUtils.totalResults; this.oldTotalResults = this.searchUtils.totalResults;
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -221,7 +233,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting content providers in share "+type+" for organization with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.loadPaging = true; this.loadPaging = true;
this.oldTotalResults = 0; this.oldTotalResults = 0;
} }
@ -262,7 +277,7 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
this.oldTotalResults = this.searchUtils.totalResults; this.oldTotalResults = this.searchUtils.totalResults;
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -275,7 +290,10 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting content providers in share "+type+" by subject: "+subject, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.loadPaging = true; this.loadPaging = true;
this.oldTotalResults = 0; this.oldTotalResults = 0;
} }
@ -307,7 +325,7 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -320,7 +338,9 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting content providers for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -343,7 +363,7 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -356,8 +376,14 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting content providers for entity registry with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Content Providers (class): "+message, error);
}
} }

View File

@ -1,5 +1,6 @@
import {SearchDatasetsService} from '../../services/searchDatasets.service'; import {SearchDatasetsService} from '../../services/searchDatasets.service';
import { ErrorCodes} from '../../utils/properties/errorCodes'; import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class'; import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject'; import {Subject} from 'rxjs/Subject';
@ -7,6 +8,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class'; import {StringUtils} from '../../utils/string-utils.class';
export class FetchDatasets{ export class FetchDatasets{
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
public requestComplete: Subject<void>; public requestComplete: Subject<void>;
@ -20,6 +22,7 @@ export class FetchDatasets{
constructor ( private _searchDatasetsService: SearchDatasetsService ) { constructor ( private _searchDatasetsService: SearchDatasetsService ) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject<void>(); this.requestComplete = new Subject<void>();
@ -70,6 +73,7 @@ export class FetchDatasets{
} }
}, },
err => { err => {
/*
console.log(err); console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
@ -84,6 +88,9 @@ export class FetchDatasets{
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }
*/
this.handleError("Error getting research data for keyword: "+keyword + (doisParams ? "(DOI)" : ""), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -105,6 +112,7 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
} }
}, },
err => { err => {
/*
console.log(err); console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
@ -119,6 +127,9 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }
*/
this.handleError("Error getting research data for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -151,6 +162,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
} }
}, },
err => { err => {
/*
console.log(err); console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
@ -165,6 +177,9 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }
*/
this.handleError("Error getting research data for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -196,6 +211,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
} }
}, },
err => { err => {
/*
console.log(err); console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
@ -209,7 +225,9 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting research data for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -233,6 +251,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.requestComplete.complete(); this.requestComplete.complete();
}, },
err => { err => {
/*
console.log(err); console.log(err);
//console.info("status: "+err.status); //console.info("status: "+err.status);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
@ -247,11 +266,16 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting research data for aggregator with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.requestComplete.complete(); this.requestComplete.complete();
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Research Data (class): "+message, error);
}
} }

View File

@ -1,10 +1,12 @@
import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import { ErrorCodes} from '../../utils/properties/errorCodes'; import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties'; import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class'; import {StringUtils} from '../../utils/string-utils.class';
export class FetchOrganizations { export class FetchOrganizations {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
@ -17,6 +19,7 @@ export class FetchOrganizations {
constructor ( private _searchOrganizationsService: SearchOrganizationsService ) { constructor ( private _searchOrganizationsService: SearchOrganizationsService ) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
} }
@ -54,7 +57,7 @@ export class FetchOrganizations {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -68,10 +71,14 @@ export class FetchOrganizations {
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting organization for keyword: "+keyword, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Organizations (class): "+message, error);
}
} }

View File

@ -1,5 +1,6 @@
import {SearchOrpsService} from '../../services/searchOrps.service'; import {SearchOrpsService} from '../../services/searchOrps.service';
import { ErrorCodes} from '../../utils/properties/errorCodes'; import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class'; import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject'; import {Subject} from 'rxjs/Subject';
@ -8,6 +9,7 @@ import {StringUtils} from '../../utils/string-utils.class';
export class FetchOrps{ export class FetchOrps{
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
public requestComplete: Subject<void>; public requestComplete: Subject<void>;
@ -21,6 +23,7 @@ export class FetchOrps{
constructor ( private _searchOrpsService: SearchOrpsService ) { constructor ( private _searchOrpsService: SearchOrpsService ) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject<void>(); this.requestComplete = new Subject<void>();
@ -68,6 +71,7 @@ export class FetchOrps{
} }
}, },
err => { err => {
/*
console.log(err); console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
if(err.status == '404') { if(err.status == '404') {
@ -76,7 +80,9 @@ export class FetchOrps{
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting other research products for keyword: "+keyword+ (doisParams ? "(DOI)" : ""), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -96,7 +102,7 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
if(err.status == '404') { if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND; this.searchUtils.status = this.errorCodes.NOT_FOUND;
@ -104,7 +110,9 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting number of other research products for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -133,7 +141,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
if(err.status == '404') { if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND; this.searchUtils.status = this.errorCodes.NOT_FOUND;
@ -141,7 +149,9 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting other research products for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -172,7 +182,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
if(err.status == '404') { if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND; this.searchUtils.status = this.errorCodes.NOT_FOUND;
@ -180,7 +190,9 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting other research products for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -202,7 +214,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.requestComplete.complete(); this.requestComplete.complete();
}, },
err => { err => {
console.log(err); /*console.log(err);
//console.info("status: "+err.status); //console.info("status: "+err.status);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
if(err.status == '404') { if(err.status == '404') {
@ -211,11 +223,16 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting other research products for aggrgator with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.requestComplete.complete(); this.requestComplete.complete();
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Other Research Data (class): "+message, error);
}
} }

View File

@ -1,10 +1,12 @@
import {SearchProjectsService} from '../../services/searchProjects.service'; import {SearchProjectsService} from '../../services/searchProjects.service';
import {ErrorCodes} from '../../utils/properties/errorCodes'; import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties'; import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class'; import {StringUtils} from '../../utils/string-utils.class';
export class FetchProjects{ export class FetchProjects{
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
@ -18,6 +20,7 @@ export class FetchProjects{
constructor (private _searchProjectsService: SearchProjectsService) { constructor (private _searchProjectsService: SearchProjectsService) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
} }
@ -53,7 +56,7 @@ export class FetchProjects{
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -66,7 +69,9 @@ export class FetchProjects{
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting projects for keyword: "+keyword, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -88,7 +93,7 @@ export class FetchProjects{
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -101,7 +106,9 @@ export class FetchProjects{
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting projects for content provider with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -123,7 +130,7 @@ export class FetchProjects{
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -137,7 +144,9 @@ export class FetchProjects{
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting number of projects for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -188,7 +197,7 @@ export class FetchProjects{
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -201,10 +210,14 @@ export class FetchProjects{
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting projects for organization with id: "+organizationId, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Projects (class): "+message, error);
}
} }

View File

@ -1,6 +1,7 @@
import {SearchPublicationsService} from '../../services/searchPublications.service'; import {SearchPublicationsService} from '../../services/searchPublications.service';
import {ErrorCodes} from '../../utils/properties/errorCodes'; import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class'; import {DOI} from '../../utils/string-utils.class';
@ -9,6 +10,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class'; import {StringUtils} from '../../utils/string-utils.class';
export class FetchPublications { export class FetchPublications {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
@ -34,6 +36,7 @@ export class FetchPublications {
constructor ( private _searchPublicationsService: SearchPublicationsService ) { constructor ( private _searchPublicationsService: SearchPublicationsService ) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject<void>(); this.requestComplete = new Subject<void>();
@ -82,7 +85,7 @@ export class FetchPublications {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -95,7 +98,9 @@ export class FetchPublications {
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting publications for keyword: "+keyword + (doisParams ? "(DOI)" : ""), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -117,7 +122,7 @@ export class FetchPublications {
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -130,7 +135,9 @@ export class FetchPublications {
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting publications for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -162,7 +169,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -176,7 +183,9 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting publications for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -208,7 +217,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -221,7 +230,9 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting publications for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -245,7 +256,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.requestComplete.complete(); this.requestComplete.complete();
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -258,12 +269,16 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting publications for aggregator with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.requestComplete.complete(); this.requestComplete.complete();
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Publications (class): "+message, error);
}
} }

View File

@ -1,5 +1,6 @@
import {SearchSoftwareService} from '../../services/searchSoftware.service'; import {SearchSoftwareService} from '../../services/searchSoftware.service';
import { ErrorCodes} from '../../utils/properties/errorCodes'; import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class'; import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject'; import {Subject} from 'rxjs/Subject';
@ -8,6 +9,7 @@ import {StringUtils} from '../../utils/string-utils.class';
export class FetchSoftware{ export class FetchSoftware{
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[]; public results =[];
public requestComplete: Subject<void>; public requestComplete: Subject<void>;
@ -21,6 +23,7 @@ export class FetchSoftware{
constructor ( private _searchSoftwareService: SearchSoftwareService ) { constructor ( private _searchSoftwareService: SearchSoftwareService ) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject<void>(); this.requestComplete = new Subject<void>();
@ -71,7 +74,7 @@ export class FetchSoftware{
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -84,7 +87,9 @@ export class FetchSoftware{
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting software for keyword: "+keyword + (doisParams ? "(DOI)" : ""), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -106,7 +111,7 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -119,7 +124,9 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting software for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -150,7 +157,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -163,7 +170,9 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting software for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -195,7 +204,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
} }
}, },
err => { err => {
console.log(err); /*console.log(err);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
// this.searchUtils.status = ErrorCodes.ERROR; // this.searchUtils.status = ErrorCodes.ERROR;
@ -208,7 +217,9 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting software for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
} }
); );
} }
@ -232,7 +243,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.requestComplete.complete(); this.requestComplete.complete();
}, },
err => { err => {
console.log(err); /*console.log(err);
//console.info("status: "+err.status); //console.info("status: "+err.status);
//TODO check erros (service not available, bad request) //TODO check erros (service not available, bad request)
// if( ){ // if( ){
@ -246,11 +257,16 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
this.searchUtils.status = this.errorCodes.ERROR; this.searchUtils.status = this.errorCodes.ERROR;
} else { } else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
} }*/
this.handleError("Error getting software for aggregator with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.requestComplete.complete(); this.requestComplete.complete();
} }
); );
} }
private handleError(message: string, error) {
console.error("Fetch Software (class): "+message, error);
}
} }

View File

@ -55,8 +55,12 @@ export class HelperComponent {
this.texts = data; this.texts = data;
}, },
err => { err => {
console.log(err); //console.log(err);
if(this.div) {
this.handleError("Error getting helper for route: "+location.pathname+" and div: "+this.div+" in community with id: "+this.communityId, err);
} else {
this.handleError("Error getting helper for route: "+location.pathname+", position: "+this.position+", before parameter:"+this.before+" in community with id: "+this.communityId, err);
}
} }
); );
} }
@ -78,4 +82,8 @@ buildTooltip():string{
text+="</div>"; text+="</div>";
return text; return text;
} }
private handleError(message: string, error) {
console.error("Helper (component): "+message, error);
}
} }

View File

@ -103,7 +103,8 @@ export class StaticAutoCompleteComponent implements OnChanges{
}, },
err => { err => {
console.log(err); //console.log(err);
this.handleError("Error getting vocabulary with id: "+this.vocabularyId+" for "+this.entityName, err);
this.warningMessage = "An Error occured..." this.warningMessage = "An Error occured..."
} }
); );
@ -115,7 +116,8 @@ export class StaticAutoCompleteComponent implements OnChanges{
}, },
err => { err => {
console.log(err); //console.log(err);
this.handleError("Error getting results for refine field: "+this.fieldName+" for "+this.entityName, err);
this.warningMessage = "An Error occured..." this.warningMessage = "An Error occured..."
} }
); );
@ -297,4 +299,7 @@ export class StaticAutoCompleteComponent implements OnChanges{
} }
} }
private handleError(message: string, error) {
console.error("Static Autocomplete (component): "+message, error);
}
} }