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

Better assertAlive error (show name of invoked action or accessed field) #1142

Closed
2 tasks
Amareis opened this issue Jan 18, 2019 · 13 comments
Closed
2 tasks
Assignees
Labels
enhancement Possible enhancement has PR A Pull Request to fix the issue is available

Comments

@Amareis
Copy link

Amareis commented Jan 18, 2019

Feature request

Is your feature request related to a problem? Please describe.
When actions are invoked at destoyed node, there is no action name in error description, which can be helpful for debug. Currently I should use breakpoint on error throwing inside mst code to see stacktrace and look at action name.

Describe the solution you'd like
Show action name in assertAlive error if possible, or, in general, name of accessed field.

Are you willing to (attempt) a PR?

  • Yes
  • No
@xaviergonz
Copy link
Contributor

I think if we console log an error then it should show the full stack trace even on warning mode (like it does in error mode), would that be good enough?

@xaviergonz xaviergonz added the enhancement Possible enhancement label Jan 22, 2019
@xaviergonz xaviergonz self-assigned this Jan 22, 2019
@xaviergonz xaviergonz added the has PR A Pull Request to fix the issue is available label Jan 22, 2019
@xaviergonz
Copy link
Contributor

xaviergonz commented Jan 22, 2019

PR merged, an stacktrace will show in the console in warn mode in the next release

@Amareis
Copy link
Author

Amareis commented Jan 22, 2019

I'm used error mode, but even with it stacktrace sometimes is not really informative.

@xaviergonz
Copy link
Contributor

Ah, feel free to reopen the issue then if you think the new addition is not enough

@Amareis
Copy link
Author

Amareis commented Jan 23, 2019

image
image

Simple example, I just cannot see full stacktrace at sentry and even actions, which i used as breadcrumbs, isn't very helpful. But if i'll see accessed property name, it be way more easier to debug this situation.

@xaviergonz
Copy link
Contributor

Did you check in the actual browser console? It should show an arrow near the error line that allows you to see the full stack trace once expanded (at least in chrome)

@Amareis
Copy link
Author

Amareis commented Jan 23, 2019

In browser stacktrace is available, of course. But there is situations, when in stacktrace there is no any my source files - for example, if you add some arrow function callback, which is reading some field from mst, stacktrace just don't showing any meaningful strings in stacktrace, because it contains only call string of this callback, but not define's string.

@xaviergonz
Copy link
Contributor

I thought sentry could be configured to use source maps and browse stack traces.
Either way reopening.

@xaviergonz xaviergonz reopened this Jan 23, 2019
@Amareis
Copy link
Author

Amareis commented Jan 23, 2019

In our sentry sourcemaps are enabled, of course. But, as I said, even stacktraces isn't helpful sometimes, so name of acessed property should simplify debug in some cases.

@xaviergonz
Copy link
Contributor

@Amareis would this pr fix your issue?
#1147

@Amareis
Copy link
Author

Amareis commented Jan 23, 2019

Yeah, just that I needed! Big thanks for it.

@Amareis
Copy link
Author

Amareis commented Jul 15, 2019

Error displays wrong action path. There is should be /.setData() path (this is action at tree root, which is replace whole subtree).

Error: [mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree. (Object type: 'Chat', Path upon death: '/data/chats/items/4cd66e4b-09be-4c21-8153-1fa37f69758b', Subpath: 'id', Action: '/data/chats/items/4cd66e4b-09be-4c21-8153-1fa37f69758b.setData()'). Either detach nodes first, or don't use objects after removing / replacing them in the

@lock
Copy link

lock bot commented Jan 14, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Possible enhancement has PR A Pull Request to fix the issue is available
Projects
None yet
Development

No branches or pull requests

2 participants