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

Javascript error when invalid host is set in the settings #235

Open
2 tasks
Hyzual opened this issue Apr 2, 2016 · 1 comment
Open
2 tasks

Javascript error when invalid host is set in the settings #235

Hyzual opened this issue Apr 2, 2016 · 1 comment

Comments

@Hyzual
Copy link
Contributor

Hyzual commented Apr 2, 2016

Given I set an invalid host such as http://example.com in the settings,
when I click on the "Save" button in the settings
then a javascript error is silently thrown, the user only sees a notification "Settings Updated!".
The user should see an error similar to "Error when contacting the Subsonic server. HTTP error 404 Not Found".

I am currently busy with other projects so I'm not going to be able to deal with it, but I can still find enough time to integrate changes and release. PRs welcome for this issue 😄

If you want to contribute, I can point you in the right direction:

  • Modify subsonic-service.js. There is a subsonicRequest function that is in charge of dealing with building the REST url to query given the settings (username, etc) and dealing with errors. You'll need to check that data exists in the .sucess(). I also think it would be better to use .then() and .catch() instead of .success() and .error() which are now deprecated.
  • Add a unit test to subsonic-service_test.js to check that a promise is rejected even if the http promise is resolved with no data.
@carnifux
Copy link

carnifux commented Apr 7, 2016

this also happens when you have a trailing slash on the url, ie http://me.com:8080/subsonic/, though frankly that could be fixed by trimming the slash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants