throw on exit

This commit is contained in:
boufni95 2025-09-26 18:12:08 +00:00
parent b1e9dd80a7
commit eae62c4f4e
3 changed files with 5 additions and 4 deletions

View file

@ -20,11 +20,11 @@ export default class NostrSubprocess {
this.childProcess = fork("./build/src/services/nostr/handler") this.childProcess = fork("./build/src/services/nostr/handler")
this.childProcess.on("error", (error) => { this.childProcess.on("error", (error) => {
this.log(ERROR, "nostr subprocess error", error) this.log(ERROR, "nostr subprocess error", error)
throw error
}) })
this.childProcess.on("exit", (code) => { this.childProcess.on("exit", (code) => {
this.log(ERROR, "nostr subprocess exited with code", `nostr subprocess exited with code ${code}`) this.log(ERROR, `nostr subprocess exited with code ${code}`)
throw new Error(`nostr subprocess exited with code ${code}`)
}) })
this.childProcess.on("message", (message: ChildProcessResponse) => { this.childProcess.on("message", (message: ChildProcessResponse) => {

View file

@ -59,12 +59,12 @@ export class StorageInterface extends EventEmitter {
this.process.on('error', (error: Error) => { this.process.on('error', (error: Error) => {
this.log(ERROR, 'Storage processor error:', error); this.log(ERROR, 'Storage processor error:', error);
this.isConnected = false; this.isConnected = false;
throw error
}); });
this.process.on('exit', (code: number) => { this.process.on('exit', (code: number) => {
this.log(ERROR, `Storage processor exited with code ${code}`); this.log(ERROR, `Storage processor exited with code ${code}`);
this.isConnected = false; this.isConnected = false;
throw new Error(`Storage processor exited with code ${code}`)
}); });
this.isConnected = true; this.isConnected = true;

View file

@ -60,6 +60,7 @@ export class TlvStorageFactory extends EventEmitter {
this.process.on('exit', (code: number) => { this.process.on('exit', (code: number) => {
this.log(ERROR, `Tlv Storage processor exited with code ${code}`); this.log(ERROR, `Tlv Storage processor exited with code ${code}`);
this.isConnected = false; this.isConnected = false;
throw new Error(`Tlv Storage processor exited with code ${code}`)
}); });
this.isConnected = true; this.isConnected = true;