output/pulse: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-11-02 10:43:25 +01:00
parent 6532c7e089
commit 6ead9750f4
3 changed files with 108 additions and 156 deletions

View File

@@ -19,15 +19,14 @@
#include "config.h"
#include "Error.hxx"
#include "Domain.hxx"
#include "util/Error.hxx"
#include "util/RuntimeError.hxx"
#include <pulse/context.h>
#include <pulse/error.h>
void
SetPulseError(Error &error, pa_context *context, const char *prefix)
std::runtime_error
MakePulseError(pa_context *context, const char *prefix)
{
const int e = pa_context_errno(context);
error.Format(pulse_domain, e, "%s: %s", prefix, pa_strerror(e));
return FormatRuntimeError("%s: %s", prefix, pa_strerror(e));
}

View File

@@ -20,10 +20,11 @@
#ifndef MPD_PULSE_ERROR_HXX
#define MPD_PULSE_ERROR_HXX
class Error;
#include <stdexcept>
struct pa_context;
void
SetPulseError(Error &error, pa_context *context, const char *prefix);
std::runtime_error
MakePulseError(pa_context *context, const char *prefix);
#endif