From be05bc156d937a5e21bf235065a19c4efa65a6f8 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sat, 17 Apr 2021 17:56:01 +0700 Subject: [PATCH] Change services to log an error when not spawning --- sources/Service.uc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sources/Service.uc b/sources/Service.uc index 62e46bb..3c0dae3 100644 --- a/sources/Service.uc +++ b/sources/Service.uc @@ -24,6 +24,8 @@ class Service extends Singleton // Listeners listed here will be automatically activated. var public const array< class > requiredListeners; +var LoggerAPI.Definition errNoService; + // Enables feature of given class. public static final function Service Require() { @@ -35,6 +37,9 @@ public static final function Service Require() default.blockSpawning = false; newInstance = Service(__().memory.Allocate(default.class)); default.blockSpawning = true; + if (newInstance == none) { + __().logger.Auto(default.errNoService).ArgClass(default.class); + } return newInstance; } @@ -78,4 +83,5 @@ defaultproperties blockSpawning = true // Features are server-only actors remoteRole = ROLE_None + errNoService = "Cannot start required service %1." } \ No newline at end of file