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

surface request error message, fixes #91 #107

Closed
wants to merge 5 commits into from

Conversation

RasPhilCo
Copy link
Contributor

@RasPhilCo RasPhilCo commented Aug 21, 2018

Fixes #91

@@ -34,10 +34,10 @@ function EventSource (url, eventSourceInitDict) {
var self = this
self.reconnectInterval = 1000

function onConnectionClosed () {
function onConnectionClosed (message=undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

If you don't provide message argument, it's already undefined by default, so it's superfluous. Please remove the default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, TS linter artifact I forgot to cleanup, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

You are welcome :-)

if (readyState === EventSource.CLOSED) return
readyState = EventSource.CONNECTING
_emit('error', new Event('error'))
_emit('error', new Event('error', {message: message}))
Copy link
Member

Choose a reason for hiding this comment

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

Use object destructure.

Copy link

Choose a reason for hiding this comment

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

technically this makes it a breaking change as it breaks compatibility with node 0.12

Copy link
Member

Choose a reason for hiding this comment

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

Node.js 0.12 is by far obsolete and unsupported, so I would not worry about it. If it would be a still supported version, then I would agree it would be a breaking change and would accept not including it, but being not the case, it's better to keep up with latests language idioms to have a clean code.

Copy link

Choose a reason for hiding this comment

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

I just point it out because it breaks your test suite

Copy link
Member

Choose a reason for hiding this comment

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

That's true. Can you be able to update the .travis.yml file to remove the deprecated ones?

@aslakhellesoy
Copy link
Contributor

Can you add tests please?

@RasPhilCo
Copy link
Contributor Author

Good to go?

@rexxars
Copy link
Member

rexxars commented Aug 24, 2018

Merged manually in c37a572 - made some minor changes to preserve compatibility

@rexxars rexxars closed this Aug 24, 2018
@RasPhilCo RasPhilCo deleted the surface-error-msg branch August 24, 2018 17:14
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.

5 participants