@@ -37,7 +37,9 @@ public enum Lambda {
3737 ///
3838 /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
3939 public static func run( _ handler: Handler ) {
40- self . run ( handler: handler)
40+ if case . failure( let error) = self . run ( handler: handler) {
41+ fatalError ( " \( error) " )
42+ }
4143 }
4244
4345 /// Run a Lambda defined by implementing the `LambdaHandler` protocol provided via a `LambdaHandlerFactory`.
@@ -49,7 +51,9 @@ public enum Lambda {
4951 ///
5052 /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
5153 public static func run( _ factory: @escaping HandlerFactory ) {
52- self . run ( factory: factory)
54+ if case . failure( let error) = self . run ( factory: factory) {
55+ fatalError ( " \( error) " )
56+ }
5357 }
5458
5559 /// Run a Lambda defined by implementing the `LambdaHandler` protocol provided via a factory, typically a constructor.
@@ -59,7 +63,9 @@ public enum Lambda {
5963 ///
6064 /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
6165 public static func run( _ factory: @escaping ( InitializationContext ) throws -> Handler ) {
62- self . run ( factory: factory)
66+ if case . failure( let error) = self . run ( factory: factory) {
67+ fatalError ( " \( error) " )
68+ }
6369 }
6470
6571 /// Utility to access/read environment variables
@@ -71,13 +77,11 @@ public enum Lambda {
7177 }
7278
7379 // for testing and internal use
74- @discardableResult
7580 internal static func run( configuration: Configuration = . init( ) , handler: Handler ) -> Result < Int , Error > {
7681 self . run ( configuration: configuration, factory: { $0. eventLoop. makeSucceededFuture ( handler) } )
7782 }
7883
7984 // for testing and internal use
80- @discardableResult
8185 internal static func run( configuration: Configuration = . init( ) , factory: @escaping ( InitializationContext ) throws -> Handler ) -> Result < Int , Error > {
8286 self . run ( configuration: configuration, factory: { context -> EventLoopFuture < Handler > in
8387 let promise = context. eventLoop. makePromise ( of: Handler . self)
@@ -95,7 +99,6 @@ public enum Lambda {
9599 }
96100
97101 // for testing and internal use
98- @discardableResult
99102 internal static func run( configuration: Configuration = . init( ) , factory: @escaping HandlerFactory ) -> Result < Int , Error > {
100103 let _run = { ( configuration: Configuration , factory: @escaping HandlerFactory ) -> Result < Int , Error > in
101104 Backtrace . install ( )
0 commit comments