Skip to content

Commit

Permalink
Merge pull request #94 from teofilomonteiro/fix/context-environment-v…
Browse files Browse the repository at this point in the history
…alidation

fix: ensure that the enviroment context validation is actually a check to API context level
  • Loading branch information
obsd authored Sep 16, 2024
2 parents 59fba0f + 493a550 commit 7c66cc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/api/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7c66cc5

Please sign in to comment.