@@ -37,7 +37,9 @@ public enum Lambda {
37
37
///
38
38
/// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
39
39
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
+ }
41
43
}
42
44
43
45
/// Run a Lambda defined by implementing the `LambdaHandler` protocol provided via a `LambdaHandlerFactory`.
@@ -49,7 +51,9 @@ public enum Lambda {
49
51
///
50
52
/// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
51
53
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
+ }
53
57
}
54
58
55
59
/// Run a Lambda defined by implementing the `LambdaHandler` protocol provided via a factory, typically a constructor.
@@ -59,7 +63,9 @@ public enum Lambda {
59
63
///
60
64
/// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
61
65
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
+ }
63
69
}
64
70
65
71
/// Utility to access/read environment variables
@@ -71,13 +77,11 @@ public enum Lambda {
71
77
}
72
78
73
79
// for testing and internal use
74
- @discardableResult
75
80
internal static func run( configuration: Configuration = . init( ) , handler: Handler ) -> Result < Int , Error > {
76
81
self . run ( configuration: configuration, factory: { $0. eventLoop. makeSucceededFuture ( handler) } )
77
82
}
78
83
79
84
// for testing and internal use
80
- @discardableResult
81
85
internal static func run( configuration: Configuration = . init( ) , factory: @escaping ( InitializationContext ) throws -> Handler ) -> Result < Int , Error > {
82
86
self . run ( configuration: configuration, factory: { context -> EventLoopFuture < Handler > in
83
87
let promise = context. eventLoop. makePromise ( of: Handler . self)
@@ -95,7 +99,6 @@ public enum Lambda {
95
99
}
96
100
97
101
// for testing and internal use
98
- @discardableResult
99
102
internal static func run( configuration: Configuration = . init( ) , factory: @escaping HandlerFactory ) -> Result < Int , Error > {
100
103
let _run = { ( configuration: Configuration , factory: @escaping HandlerFactory ) -> Result < Int , Error > in
101
104
Backtrace . install ( )
0 commit comments