Skip to content

Commit

Permalink
Added specs and tidied
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Howard committed Sep 9, 2023
1 parent adc8cf8 commit bd49bf8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/bundle.js.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/BehaviourTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class BehaviourTree {
return rootNode;
} catch (exception) {
// There was an issue in trying to parse and build the tree definition.
throw new Error(`error parsing tree: ${(exception as Error).message}\n${(exception as Error).stack}`);
throw new Error(`error parsing tree: ${(exception as Error).message}`);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/RootAstNodesBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ export default function buildRootASTNodes(definition: string): RootAstNode[] {
}

default: {
throw new Error("unexpected token: " + token);
throw new Error(`unexpected token '${token}'`);
}
}
}
Expand Down Expand Up @@ -995,7 +995,8 @@ function popAndCheck(tokens: string[], expected: string | string[]) {
.concat(expected)
.map((item) => "'" + item + "'")
.join(" or ");
throw new Error("unexpected token found. Expected " + expectationString + " but got '" + popped + "'");

throw new Error(`unexpected token found. Expected '${expectationString}' but got '${popped}'`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/behaviourTree.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("A BehaviourTree instance", () => {
assert.throws(
() => new mistreevous.BehaviourTree("invalid-token { }", {}),
Error,
"error parsing tree: unexpected token: invalid-token"
"error parsing tree: unexpected token 'invalid-token'"
);
});

Expand Down

0 comments on commit bd49bf8

Please sign in to comment.