diff --git a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts index 5e4807ade3..b87eb9ef0f 100644 --- a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +++ b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts @@ -17,7 +17,7 @@ export class Gn4PlatformService implements PlatformServiceInterface { private readonly type = 'GeoNetwork' private me$: Observable private users$: Observable - isAnonymous$: Observable + private isAnonymous$: Observable private settings$ = of(true).pipe( switchMap(() => this.siteApiService.getSiteOrPortalDescription()), @@ -26,18 +26,16 @@ export class Gn4PlatformService implements PlatformServiceInterface { private readonly apiVersion$ = this.settings$.pipe( map((info) => info['system/platform/version'] as string), + tap((version) => { + if (ltr(version, minApiVersion)) { + throw new Error( + `Gn4 API version is not compatible.\nMinimum: ${minApiVersion}\nYour version: ${version}` + ) + } + }), shareReplay(1) ) - private readonly isApiCompatible$ = this.apiVersion$.pipe( - tap( - (version) => - version < minApiVersion && - console.warn(`The GeoNetwork Api version is too low ${version}`) - ), - map((version) => version >= minApiVersion) - ) - constructor( private siteApiService: SiteApiService, private meApi: MeApiService, @@ -62,9 +60,6 @@ export class Gn4PlatformService implements PlatformServiceInterface { getApiVersion(): Observable { return this.apiVersion$ } - isApiCompatible(): Observable { - return this.isApiCompatible$ - } getMe(): Observable { return this.me$ diff --git a/libs/common/domain/src/lib/platform.service.interface.ts b/libs/common/domain/src/lib/platform.service.interface.ts index 7872c2d052..4711d1d047 100644 --- a/libs/common/domain/src/lib/platform.service.interface.ts +++ b/libs/common/domain/src/lib/platform.service.interface.ts @@ -5,7 +5,6 @@ import { Organization } from './model/record/organization.model' export abstract class PlatformServiceInterface { abstract getType(): string abstract getApiVersion(): Observable - abstract isApiCompatible(): Observable abstract getMe(): Observable abstract isAnonymous(): Observable