Merge pull request #312 from feross/cast-errors
Consistent error handling on all cast devices
This commit is contained in:
@@ -24,7 +24,11 @@ var update
|
|||||||
function chromecastPlayer (player) {
|
function chromecastPlayer (player) {
|
||||||
function addEvents () {
|
function addEvents () {
|
||||||
player.on('error', function (err) {
|
player.on('error', function (err) {
|
||||||
player.errorMessage = err.message
|
state.playing.location = 'local'
|
||||||
|
state.errors.push({
|
||||||
|
time: new Date().getTime(),
|
||||||
|
message: 'Could not connect to Chromecast. ' + err.message
|
||||||
|
})
|
||||||
update()
|
update()
|
||||||
})
|
})
|
||||||
player.on('disconnect', function () {
|
player.on('disconnect', function () {
|
||||||
@@ -41,6 +45,10 @@ function chromecastPlayer (player) {
|
|||||||
}, function (err) {
|
}, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
state.playing.location = 'local'
|
state.playing.location = 'local'
|
||||||
|
state.errors.push({
|
||||||
|
time: new Date().getTime(),
|
||||||
|
message: 'Could not connect to Chromecast. ' + err.message
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
state.playing.location = 'chromecast'
|
state.playing.location = 'chromecast'
|
||||||
}
|
}
|
||||||
@@ -96,7 +104,7 @@ function airplayPlayer (player) {
|
|||||||
state.playing.location = 'local'
|
state.playing.location = 'local'
|
||||||
state.errors.push({
|
state.errors.push({
|
||||||
time: new Date().getTime(),
|
time: new Date().getTime(),
|
||||||
message: 'Couldn\'t connect to Airplay'
|
message: 'Could not connect to AirPlay.'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
state.playing.location = 'airplay'
|
state.playing.location = 'airplay'
|
||||||
@@ -151,7 +159,11 @@ function airplayPlayer (player) {
|
|||||||
function dlnaPlayer (player) {
|
function dlnaPlayer (player) {
|
||||||
function addEvents () {
|
function addEvents () {
|
||||||
player.on('error', function (err) {
|
player.on('error', function (err) {
|
||||||
player.errorMessage = err.message
|
state.playing.location = 'local'
|
||||||
|
state.errors.push({
|
||||||
|
time: new Date().getTime(),
|
||||||
|
message: 'Could not connect to DLNA. ' + err.message
|
||||||
|
})
|
||||||
update()
|
update()
|
||||||
})
|
})
|
||||||
player.on('disconnect', function () {
|
player.on('disconnect', function () {
|
||||||
@@ -171,7 +183,7 @@ function dlnaPlayer (player) {
|
|||||||
state.playing.location = 'local'
|
state.playing.location = 'local'
|
||||||
state.errors.push({
|
state.errors.push({
|
||||||
time: new Date().getTime(),
|
time: new Date().getTime(),
|
||||||
message: 'Couldn\'t connect to DLNA. ' + err
|
message: 'Could not connect to DLNA. ' + err.message
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
state.playing.location = 'dlna'
|
state.playing.location = 'dlna'
|
||||||
|
|||||||
Reference in New Issue
Block a user