Skip to content

Commit

Permalink
refactor: implement review remarks (#CO-731)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlikasam-askui committed Jun 17, 2024
1 parent a94153a commit 6895cb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AIElementCollection {
logger.debug(`Collecting AIElements for workspace '${workspaceId}' ...`);

if (workspaceId === undefined) {
throw new AIElementError('workspaceId is undefined.');
throw new AIElementError("Value of 'workspaceId' must be defined.");
}

const workspaceAIElementFolder = path.join(
Expand Down Expand Up @@ -70,7 +70,7 @@ export class AIElementCollection {

getByName(name: string): CustomElementJson[] {
if (name === '') {
throw new AIElementError('AIElement cannot have an empty name.');
throw new AIElementError("Parameter 'name' must be non-empty. This might be due to corrupted metadata.");
}

logger.debug(`Getting all CustomElementJson with the name '${name}' ...`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('AIElement', () => {
it('should throw an error for unsupported version', () => {
const invalidMetadata = { ...dummyAIElementMetadata, version: 2 };
expect(() => AIElement.fromJson(invalidMetadata, dummyImagePath)).toThrow(
'unsupported AIElement version',
'Unsupported AIElement version',
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/askui-nodejs/src/core/ai-element/ai-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AIElement {
if (json.version === 1) {
return new AIElement(json.name, imagePath, json.image?.mask);
}
throw new AIElementError(`unsupported AIElement version '${json.version}'.`);
throw new AIElementError(`Unsupported AIElement version '${json.version}'.`);
}

toCustomElement(): CustomElementJson {
Expand Down

0 comments on commit 6895cb8

Please sign in to comment.