Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2230 - computedvalue: throw error object instead of string when options is e… #2243

Merged
merged 2 commits into from
Dec 31, 2019
Merged

Fixes #2230 - computedvalue: throw error object instead of string when options is e… #2243

merged 2 commits into from
Dec 31, 2019

Conversation

ramkumarvenkat
Copy link
Contributor

@ramkumarvenkat ramkumarvenkat commented Dec 21, 2019

…mpty

Fixes #2230

PR checklist:

  • Added unit tests
  • Updated changelog
  • Updated /docs. For new functionality, at least API.md should be updated
  • Added typescript typings
  • Verified that there is no significant performance drop (npm run perf)

@ramkumarvenkat
Copy link
Contributor Author

Is there a way I can unit test these changes? Any help appreciated!

@ramkumarvenkat ramkumarvenkat changed the title computedvalue: throw error object instead of string when options is e… Fixes #2230 - computedvalue: throw error object instead of string when options is e… Dec 21, 2019
@@ -105,8 +105,7 @@ export class ComputedValue<T> implements IObservable, IComputedValue<T>, IDeriva
* This is useful for working with vectors, mouse coordinates etc.
*/
constructor(options: IComputedValueOptions<T>) {
if (process.env.NODE_ENV !== "production" && !options.get)
throw "[mobx] missing option for computed: get"
invariant(options.get, "missing option for computed: get")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep [mobx] prefix there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielkcz
Copy link
Contributor

Not sure about how to unit test this or if it's necessary. Update changelog, please. And also we will need another PR to mobx4-master. You can wait with that when this one is approved.

@ramkumarvenkat
Copy link
Contributor Author

@FredyC Thanks! I have updated the changelog to create a new version.

Also the PR on mobx4-master: #2244

@danielkcz danielkcz merged commit b890a1d into mobxjs:master Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MobX errors thrown as strings aren't properly caught and obfuscate the actual error
2 participants