Repository navigation
Warn when disposables outside our control are not valid - #204
Conversation
DisposablesThere was a problem hiding this comment.
Do you think it would be good to log out @item as well, so people know which one it was.
There was a problem hiding this comment.
Could even capture a stack trace.
There was a problem hiding this comment.
Nice ideas! ✨ I'd prefer not to use the @ notation, though, as it's strictly related to Coffeescript (and packages could be written in another language).
I'll go with something like the following:
console.warn new Error("item::onDidChangeFoo does not return a valid Disposable").stackThere was a problem hiding this comment.
Nice ideas! ✨ I'd prefer not to use the @ notation, though
Sorry, I meant logging out the @item variable directly, like as a second argument to console.warn
So people can inspect the object in the dev tools.
There was a problem hiding this comment.
@as-cii I think @kevinsawicki meant to actually log out the item. It would need to be outside the string though to be useful. Honestly I think a stack trace on its might be enough. What do you think Kevin?
There was a problem hiding this comment.
Oops, wait. A stack trace isn't going to help. Nevermind. We need to add it in core. It's not always clear user code is going to be in the stack.
|
👍 |
|
I think it would be pretty cheap to add a little test coverage. If it were super expensive I'd agree but maybe we should just get some coverage. I can add it if you'd like. |
Sounds good, I'll add them in a while. 👍 |
|
I have written some specs and updated the code to log out Specs are currently failing on Travis because the new Atom version (that includes this change) hasn't been released yet. Thank you for your feedback, if this is good to go I'll wait for that commit to be 🚢ped before merging it. |
6279134 to
354e888
Compare
|
Okay, this should be good to go now! 💚 Please, have one last 👀 and merge at will. 🙇 |
|
👯 Many thanks @as-cii. 👯 |
Warn when disposables outside our control are not valid
|
❤️ |
Fixes #183.
I haven't added tests for these changes as I feel like it's fine to verify just the happy path (which is already covered by existing specs). Manual testing confirmed this plays nicely with git-log and the aforementioned issue.
Thoughts? 💭 I must admit I am not super in ❤️ with the code, as it adds a bit of complexity to an otherwise straightforward conditional logic. What do you think?
Thanks!
/cc: @kevinsawicki @maxbrunsfeld @nathansobo