Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Warn when disposables outside our control are not valid - #204

Merged
nathansobo merged 4 commits into
masterfrom
as-add-only-valid-disposables
Aug 28, 2015
Merged

nathansobo merged 4 commits into
masterfrom
as-add-only-valid-disposables

Conversation

@as-cii

@as-cii as-cii commented Aug 26, 2015

Copy link
Copy Markdown
Contributor

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

@as-cii as-cii changed the title Warn when disposables outside our control are not valid Disposables Warn when disposables outside our control are not valid Aug 26, 2015
Comment thread lib/tab-view.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think it would be good to log out @item as well, so people know which one it was.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could even capture a stack trace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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").stack

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

👍

@nathansobo

Copy link
Copy Markdown
Contributor

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.

@as-cii

as-cii commented Aug 26, 2015

Copy link
Copy Markdown
Contributor Author

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.

Sounds good, I'll add them in a while. 👍

@as-cii

as-cii commented Aug 26, 2015

Copy link
Copy Markdown
Contributor Author

I have written some specs and updated the code to log out @item as well. ✨

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.

@as-cii
as-cii force-pushed the as-add-only-valid-disposables branch from 6279134 to 354e888 Compare August 28, 2015 08:06
@as-cii

as-cii commented Aug 28, 2015

Copy link
Copy Markdown
Contributor Author

Okay, this should be good to go now! 💚

Please, have one last 👀 and merge at will. 🙇

@nathansobo

Copy link
Copy Markdown
Contributor

👯 Many thanks @as-cii. 👯

nathansobo pushed a commit that referenced this pull request Aug 28, 2015
Warn when disposables outside our control are not valid
@nathansobo
nathansobo merged commit e89b903 into master Aug 28, 2015
@nathansobo
nathansobo deleted the as-add-only-valid-disposables branch August 28, 2015 16:02
@as-cii

as-cii commented Aug 28, 2015

Copy link
Copy Markdown
Contributor Author

❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants