Skip to content

Commit

Permalink
Tracyboehrer/get value parity (microsoft#4639)
Browse files Browse the repository at this point in the history
* DialogStateManager.getValue does not throw for missing Scope (DotNet parity)

* Corrected DialogStateManager test

---------

Co-authored-by: Tracy Boehrer <[email protected]>
  • Loading branch information
tracyboehrer and Tracy Boehrer authored Apr 2, 2024
1 parent 6782cdd commit 7ceb965
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export class DialogStateManager {
// Get memory scope to search over
const scope = this.getMemoryScope(segments[0].toString());
if (scope == undefined) {
throw new Error(`DialogStateManager.getValue: a scope of '${segments[0]}' wasn't found.`);
console.warn(`DialogStateManager.getValue: a scope of '${segments[0]}' wasn't found for '${pathExpression}'.`);
return returnDefault();
}

// Search over path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe('Dialog State Manager', function () {
});

it('raise an error if getValue() called with an invalid scope.', function () {
assert.throws(() => this.dc.state.getValue('foo.bar'));
assert.strictEqual(this.dc.state.getValue('foo.bar'), undefined);
});

it('raise an error if setValue() called with missing path.', function () {
Expand Down

0 comments on commit 7ceb965

Please sign in to comment.