From: Galen Charlton Date: Fri, 31 Jan 2020 22:22:20 +0000 (-0500) Subject: catch events thrown by the acq search API X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0751bcceeefa114cff8012a4de2c0aa70d292e91;p=working%2FEvergreen.git catch events thrown by the acq search API At present, this does nothing more than indicate to the user that something went wrong. Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.service.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.service.ts index e7d1913f6b..bc4d3579fe 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.service.ts @@ -1,11 +1,13 @@ import {Injectable} from '@angular/core'; -import {empty} from 'rxjs'; +import {empty, throwError} from 'rxjs'; +import {map} from 'rxjs/operators'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {GridDataSource} from '@eg/share/grid/grid'; import {PcrudService} from '@eg/core/pcrud.service'; import {Pager} from '@eg/share/util/pager'; import {IdlObject} from '@eg/core/idl.service'; +import {EventService} from '@eg/core/event.service'; const defaultSearch = { lineitem: { @@ -96,6 +98,7 @@ export class AcqSearchService { constructor( private net: NetService, + private evt: EventService, private auth: AuthService, private pcrud: PcrudService ) { @@ -208,7 +211,6 @@ export class AcqSearchService { } }); }); - console.debug(andTerms); return { andTerms: andTerms, orTerms: orTerms }; } @@ -241,6 +243,14 @@ export class AcqSearchService { currentSearch.orTerms, null, opts + ).pipe( + map(res => { + if (this.evt.parse(res)) { + throw throwError(res); + } else { + return res + } + }), ); }; });