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

fix: stacktrace in computed #988

Merged
merged 4 commits into from
Mar 23, 2024
Merged

Conversation

altynbek132
Copy link
Contributor

when error is thrown in computed stacktrace should not be lost (check tests)
we have to use Error.throwWithStackTrace

Copy link

netlify bot commented Mar 22, 2024

Deploy Preview for mobx failed.

Name Link
🔨 Latest commit 9e37b12
🔍 Latest deploy log https://app.netlify.com/sites/mobx/deploys/65feb537b706300008d346f4

@altynbek132 altynbek132 changed the title Pr fix stacktrace fix: stacktrace in computed Mar 22, 2024
test('should preserve stacktrace', () async {
final stackTrace = StackTrace.current;
try {
Computed(() => Error.throwWithStackTrace(Exception('test'), stackTrace))
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a test with a simple exception instead of using Error.throwWithStackTrace ? Not all code will use this technique. We should see if the stacktrace is picked up automatically from deeper exceptions in code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -91,7 +91,7 @@ class ReactionImpl with DebugCreationStack implements Reaction {
}
Copy link
Member

Choose a reason for hiding this comment

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

Also need to bump up version and add a changelog for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.01%. Comparing base (fc3c2e7) to head (0d2acde).
Report is 1 commits behind head on main.

❗ Current head 0d2acde differs from pull request most recent head 9e37b12. Consider uploading reports for the commit 9e37b12 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #988   +/-   ##
=======================================
  Coverage   99.01%   99.01%           
=======================================
  Files          57       57           
  Lines        2024     2025    +1     
=======================================
+ Hits         2004     2005    +1     
  Misses         20       20           
Flag Coverage Δ
flutter_mobx 100.00% <ø> (ø)
mobx 98.56% <100.00%> (+<0.01%) ⬆️
mobx_codegen 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
mobx/lib/src/core/computed.dart 100.00% <100.00%> (ø)
mobx/lib/src/core/reaction.dart 98.59% <100.00%> (+0.02%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdfb466...9e37b12. Read the comment docs.

@@ -1,5 +1,5 @@
name: mobx
version: 2.3.0+1
Copy link
Member

Choose a reason for hiding this comment

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

The set_version command needs to be called from melos to also change the version.dart file for the package

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

formatting is in other pr, because there are several files being changed that are not related to current pr

…eserving stacktrace in Computed and Reaction functions
@pavanpodila pavanpodila merged commit c4c217b into mobxjs:main Mar 23, 2024
7 of 12 checks passed
@altynbek132 altynbek132 deleted the pr_fix_stacktrace branch March 23, 2024 13:19
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.

2 participants