lslErrorWithDetail function
As lslError, with liblsl's message already in hand: for a call that failed on another thread, which read the message there.
Implementation
LSLException lslErrorWithDetail(String what, int code, String detail) {
final name = switch (code) {
-1 => 'timeout',
-2 => 'lost',
-3 => 'argument',
-4 => 'internal',
_ => 'unknown',
};
final suffix = detail.isEmpty ? '' : ': $detail';
return code == -1
? LSLTimeout('$what: $name error ($code)$suffix')
: LSLException('$what: $name error ($code)$suffix');
}