lib/alsa/AllowedFormat: throw std::invalid_argument on error
This commit is contained in:
parent
de178e90f4
commit
d05c3f4e4d
|
@ -39,7 +39,7 @@ AllowedFormat::AllowedFormat(StringView s)
|
||||||
|
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
if (s.size >= sizeof(buffer))
|
if (s.size >= sizeof(buffer))
|
||||||
throw std::runtime_error("Failed to parse audio format");
|
throw std::invalid_argument("Failed to parse audio format");
|
||||||
|
|
||||||
memcpy(buffer, s.data, s.size);
|
memcpy(buffer, s.data, s.size);
|
||||||
buffer[s.size] = 0;
|
buffer[s.size] = 0;
|
||||||
|
@ -48,7 +48,7 @@ AllowedFormat::AllowedFormat(StringView s)
|
||||||
|
|
||||||
#ifdef ENABLE_DSD
|
#ifdef ENABLE_DSD
|
||||||
if (dop && format.format != SampleFormat::DSD)
|
if (dop && format.format != SampleFormat::DSD)
|
||||||
throw std::runtime_error("DoP works only with DSD");
|
throw std::invalid_argument("DoP works only with DSD");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue