@@ -50,14 +50,16 @@ public struct ServiceGroupError: Error, Hashable, Sendable {
5050
5151    /// Internal class that contains the actual error code.
5252    private  final  class  Backing :  Hashable ,  Sendable  { 
53+         let  message :  String ? 
5354        let  errorCode :  Code 
5455        let  file :  String 
5556        let  line :  Int 
5657
57-         init ( errorCode:  Code ,  file:  String ,  line:  Int )  { 
58+         init ( errorCode:  Code ,  file:  String ,  line:  Int ,  message :   String ? )  { 
5859            self . errorCode =  errorCode
5960            self . file =  file
6061            self . line =  line
62+             self . message =  message
6163        } 
6264
6365        static  func  ==  ( lhs:  Backing ,  rhs:  Backing )  ->  Bool  { 
@@ -83,35 +85,42 @@ public struct ServiceGroupError: Error, Hashable, Sendable {
8385        self . backing =  backing
8486    } 
8587
86-     /// An error that indicates  that the service group is already running.
88+     /// Indicates  that the service group is already running.
8789    public  static  func  alreadyRunning( file:  String  =  #fileID,  line:  Int  =  #line)  ->  Self  { 
8890        Self ( 
8991            . init( 
9092                errorCode:  . alreadyRunning, 
9193                file:  file, 
92-                 line:  line
94+                 line:  line, 
95+                 message:  " " 
9396            ) 
9497        ) 
9598    } 
9699
97-     /// An error that indicates  that the service group has already finished running.
100+     /// Indicates  that the service group has already finished running.
98101    public  static  func  alreadyFinished( file:  String  =  #fileID,  line:  Int  =  #line)  ->  Self  { 
99102        Self ( 
100103            . init( 
101104                errorCode:  . alreadyFinished, 
102105                file:  file, 
103-                 line:  line
106+                 line:  line, 
107+                 message:  " " 
104108            ) 
105109        ) 
106110    } 
107111
108-     /// An error that indicates that a service finished unexpectedly even though it indicated it is a long running service.
109-     public  static  func  serviceFinishedUnexpectedly( file:  String  =  #fileID,  line:  Int  =  #line)  ->  Self  { 
112+     /// Indicates that a service finished unexpectedly even though it indicated it is a long running service.
113+     public  static  func  serviceFinishedUnexpectedly( 
114+         file:  String  =  #fileID, 
115+         line:  Int  =  #line, 
116+         service:  String ? =  nil 
117+     )  ->  Self  { 
110118        Self ( 
111119            . init( 
112120                errorCode:  . serviceFinishedUnexpectedly, 
113121                file:  file, 
114-                 line:  line
122+                 line:  line, 
123+                 message:  service. flatMap  {  " Service failed( \( $0) ) "  } 
115124            ) 
116125        ) 
117126    } 
@@ -120,6 +129,6 @@ public struct ServiceGroupError: Error, Hashable, Sendable {
120129extension  ServiceGroupError :  CustomStringConvertible  { 
121130    /// A string representation of the service group error.
122131    public  var  description :  String  { 
123-         " ServiceGroupError: errorCode:  \( self . backing. errorCode) , file:  \( self . backing. file) , line:  \( self . backing. line) " 
132+         " ServiceGroupError: errorCode:  \( self . backing. errorCode) , file:  \( self . backing. file) , line:  \( self . backing. line)   \( self . backing . message . flatMap   {   " , message:  \( $0 ) "   }   ??   " " ) " 
124133    } 
125134} 
0 commit comments