Skip to content

Commit

Permalink
Update client.ts
Browse files Browse the repository at this point in the history
Modified the OpenFgaClient constructor to throw a FgaRequiredParamError with a clear message
  when the apiUrl parameter is not provided.
  • Loading branch information
Waheedsys committed Oct 1, 2024
1 parent 10534cc commit c4a69b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
generateRandomIdWithNonUniqueFallback,
setHeaderIfNotSet,
} from "./utils";
import { isWellFormedUlidString } from "./validation";
import { assertParamExists, isWellFormedUlidString } from "./validation";

export type UserClientConfigurationParams = UserConfigurationParams & {
storeId?: string;
Expand Down Expand Up @@ -210,9 +210,10 @@ export class OpenFgaClient extends BaseAPI {
} else {
this.configuration = new ClientConfiguration(configuration);
}
const { apiUrl } = this.configuration;
assertParamExists("OpenFgaClient", "apiUrl", apiUrl);

this.configuration.isValid();


this.api = new OpenFgaApi(this.configuration, axios);
this.storeId = configuration.storeId;
this.authorizationModelId = configuration.authorizationModelId;
Expand Down

0 comments on commit c4a69b2

Please sign in to comment.