Skip to content

Commit 493a550

Browse files
fix: ensure that the enviroment context validation is actually a check to API context level
1 parent 59fba0f commit 493a550

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/api/context.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,14 @@ export class ApiContext {
261261
*/
262262
public get environmentContext(): { projId: string; envId: string } {
263263
if (
264-
this._level !== ApiKeyLevel.ENVIRONMENT_LEVEL_API_KEY ||
264+
this._contextLevel !== ApiContextLevel.ENVIRONMENT ||
265265
this._project === null ||
266266
this._environment === null
267267
) {
268268
throw new PermitContextError(
269-
`You cannot get environment context, current api context is: ${this._level.toString()}`,
269+
`You cannot get environment context, current api context is: ${
270+
ApiContextLevel[this._contextLevel]
271+
}`,
270272
);
271273
}
272274
return {

0 commit comments

Comments
 (0)