output/Internal: remember the most recent error
This commit is contained in:
parent
a9f2d25957
commit
ef9acc54ec
@ -29,6 +29,8 @@
|
|||||||
#include "thread/Thread.hxx"
|
#include "thread/Thread.hxx"
|
||||||
#include "system/PeriodClock.hxx"
|
#include "system/PeriodClock.hxx"
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class MusicPipe;
|
class MusicPipe;
|
||||||
class EventLoop;
|
class EventLoop;
|
||||||
@ -255,6 +257,14 @@ struct AudioOutput {
|
|||||||
*/
|
*/
|
||||||
AudioOutputSource source;
|
AudioOutputSource source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error that occurred in the output thread. It is
|
||||||
|
* cleared whenever the output is opened successfully.
|
||||||
|
*
|
||||||
|
* Protected by #mutex.
|
||||||
|
*/
|
||||||
|
std::exception_ptr last_error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws #std::runtime_error on error.
|
* Throws #std::runtime_error on error.
|
||||||
*/
|
*/
|
||||||
|
@ -405,11 +405,14 @@ AudioOutput::Task()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::ENABLE:
|
case Command::ENABLE:
|
||||||
|
last_error = nullptr;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Enable();
|
Enable();
|
||||||
} catch (const std::runtime_error &e) {
|
} catch (const std::runtime_error &e) {
|
||||||
LogError(e);
|
LogError(e);
|
||||||
fail_timer.Update();
|
fail_timer.Update();
|
||||||
|
last_error = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
@ -421,11 +424,14 @@ AudioOutput::Task()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::OPEN:
|
case Command::OPEN:
|
||||||
|
last_error = nullptr;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Open();
|
Open();
|
||||||
} catch (const std::runtime_error &e) {
|
} catch (const std::runtime_error &e) {
|
||||||
LogError(e);
|
LogError(e);
|
||||||
fail_timer.Update();
|
fail_timer.Update();
|
||||||
|
last_error = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
|
Loading…
Reference in New Issue
Block a user