Javascript error when invalid host is set in the settings
Opened this issue · 1 comments
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 asubsonicRequest
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 thatdata
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.
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