This commit is contained in:
Dain Nilsson 2022-02-21 16:26:42 +01:00
commit 6b841f4a88
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -60,7 +60,14 @@ class RpcSession {
: _responses = StreamQueue(_process.stdout
.transform(const Utf8Decoder())
.transform(const LineSplitter())
.map((event) => RpcResponse.fromJson(jsonDecode(event)))) {
.map((event) {
try {
return RpcResponse.fromJson(jsonDecode(event));
} catch (e) {
_log.severe('Response was not valid JSON', event);
return RpcResponse.error('invalid-response', e.toString(), {});
}
})) {
_process.stderr
.transform(const Utf8Decoder())
.transform(const LineSplitter())