File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export interface ServiceConfig {
6969
7070 /**
7171 * A function to be executed each time the service crashes.
72- * Defaults to `() => {}`.
72+ * Defaults to `ctx => { if (!ctx.isServiceReady) throw new Error('Crashed before becoming ready') }`.
7373 *
7474 * This function is called with an {@link OnCrashContext} object as its only argument.
7575 *
Original file line number Diff line number Diff line change @@ -80,11 +80,13 @@ function processServiceConfig(
8080 const merged = {
8181 dependencies : [ ] ,
8282 cwd : '.' ,
83- // no default command
83+ command : undefined , // no default command
8484 env : process . env ,
8585 ready : ( ) => Promise . resolve ( ) ,
8686 forceKillTimeout : 5000 ,
87- onCrash : ( ) => { } ,
87+ onCrash : ( ctx : OnCrashContext ) => {
88+ if ( ! ctx . isServiceReady ) throw new Error ( 'Crashed before becoming ready' )
89+ } ,
8890 logTailLength : 0 ,
8991 minimumRestartDelay : 1000 ,
9092 ...removeUndefinedProperties ( defaults ) ,
You can’t perform that action at this time.
0 commit comments