From 493a55028a7e47d39b2b10e7786b84c43149b096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Te=C3=B3filo=20Monteiro?= Date: Fri, 13 Sep 2024 13:56:25 +0200 Subject: [PATCH] fix: ensure that the enviroment context validation is actually a check to API context level --- src/api/context.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api/context.ts b/src/api/context.ts index bb07bf6..da274e7 100644 --- a/src/api/context.ts +++ b/src/api/context.ts @@ -261,12 +261,14 @@ export class ApiContext { */ public get environmentContext(): { projId: string; envId: string } { if ( - this._level !== ApiKeyLevel.ENVIRONMENT_LEVEL_API_KEY || + this._contextLevel !== ApiContextLevel.ENVIRONMENT || this._project === null || this._environment === null ) { throw new PermitContextError( - `You cannot get environment context, current api context is: ${this._level.toString()}`, + `You cannot get environment context, current api context is: ${ + ApiContextLevel[this._contextLevel] + }`, ); } return {