Skip to content

Conversation

@skewart
Copy link

@skewart skewart commented Jan 14, 2016

I'm really not sure why you'd want to return a 500 here as opposed to a 204, like you with with other platforms. Squirrel.Windows throws an error when it gets a 500 back when checking for releases.

Maybe I'll discover why Nuts returns a 500 instead of a 204 soon.

@skewart skewart force-pushed the no-win-version-response branch 7 times, most recently from da467fb to 5462224 Compare January 15, 2016 21:13
lib/versions.js Outdated
Copy link
Author

Choose a reason for hiding this comment

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

These changes are required because Squirrel.Windows checks for equality locally. It never expects a 204 like Squirrel.Mac does, but instead that you return all the version info, and it will check to see if there is a newer version available. We already are checking to see if the tag is equal to the given tag in the osx update handler function, so this will be fine.

@skewart skewart force-pushed the no-win-version-response branch from 5462224 to b4cc907 Compare January 19, 2016 02:56
Copy link
Author

Choose a reason for hiding this comment

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

In the existing code Nuts is excluding any non-digit characters from the version string when it reconstructs it. This means that you don't get the complete string to compare against the local one. Though, actually, if we leave the local build strings untouched then maybe it's not such a big deal. Hang on a second, lemme check something.

@skewart skewart force-pushed the no-win-version-response branch from 9007245 to 1f20542 Compare January 19, 2016 20:32
@skewart skewart changed the title Return a 204 instead of 500 if no new Windows release is found. Update Windows pre-release version handling. Jan 19, 2016
@skewart skewart force-pushed the no-win-version-response branch 2 times, most recently from 997960c to 9be7c1e Compare January 19, 2016 23:08
Copy link
Author

Choose a reason for hiding this comment

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

I'll write tests for this...

@skewart skewart force-pushed the no-win-version-response branch 2 times, most recently from e9911bf to efe731c Compare January 20, 2016 01:42
Copy link
Author

Choose a reason for hiding this comment

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

Wrapping this in _.chain is kind of ugly. But I do like the idea of throwing an actually descriptive error rather than "Cannot read property 0 of null".

Copy link
Author

Choose a reason for hiding this comment

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

FYI, lodash's thru is kind of like tap in ruby/rails https://lodash.com/docs#thru

Choose a reason for hiding this comment

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

Should the error perhaps hint that the version info might be invalid? Something like Release missing valid version:

@skewart skewart force-pushed the no-win-version-response branch 2 times, most recently from 51140b9 to 50b4ad0 Compare January 20, 2016 17:38
lib/versions.js Outdated

Choose a reason for hiding this comment

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

I think you may have moved this out of the closure to allow for testing. Is there another way to to it? Would be nice not to have to move it. Maybe we could test the function that calls into extractChannel instead? idk.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, testing is the only reason why I moved it out. It would be nicer to test the public function that calls this instead. The only reason I didn't do that is time. It would require mocking responses from Github. (And there's no benefit for this function being in the closure). Though that's probably a good thing to do in the end - and probably before submitting a PR into the main Nuts repo.

Hmm... I'll see if I can knock out a quick mock and test things a better way.

@skewart skewart force-pushed the no-win-version-response branch from 50b4ad0 to f815cb1 Compare January 20, 2016 21:07
@kainosnoema
Copy link

LGTM

skewart added a commit that referenced this pull request Jan 21, 2016
Update Windows pre-release version handling.
@skewart skewart merged commit 1220204 into master Jan 21, 2016
@skewart skewart deleted the no-win-version-response branch January 21, 2016 00:27
ghost pushed a commit to Coldewey/nuts that referenced this pull request Jun 22, 2016
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.

3 participants