mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 13:47:54 +00:00
Catch and report cloud stream writing errors
If an error fires when writing to the cloud stream, it can stop any calling processes from completing. Given that a logging failure should not cause other processes to cancel, we catch and report the error but otherwise do nothing else. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
7ef4880beb
commit
7d1da38184
@ -203,8 +203,12 @@ export class BalenaLogBackend extends LogBackend {
|
||||
}
|
||||
|
||||
if (this.writable) {
|
||||
this.writable = this.stream.write(JSON.stringify(message) + '\n');
|
||||
this.flush();
|
||||
try {
|
||||
this.writable = this.stream.write(JSON.stringify(message) + '\n');
|
||||
this.flush();
|
||||
} catch (e) {
|
||||
log.error('Failed to write to logging stream, dropping message.', e);
|
||||
}
|
||||
} else {
|
||||
this.dropCount += 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user