File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,21 @@ export class FunctionLoader implements IFunctionLoader {
30
30
}
31
31
32
32
getInfo ( functionId : string ) : FunctionInfo {
33
- return this . _loadedFunctions [ functionId ] . info ;
33
+ let loadedFunction = this . _loadedFunctions [ functionId ] ;
34
+ if ( loadedFunction && loadedFunction . info ) {
35
+ return loadedFunction . info ;
36
+ } else {
37
+ throw `Function info for '${ functionId } ' is not loaded and cannot be invoked.` ;
38
+ }
34
39
}
35
40
36
41
getFunc ( functionId : string ) : Function {
37
- return this . _loadedFunctions [ functionId ] . func ;
42
+ let loadedFunction = this . _loadedFunctions [ functionId ] ;
43
+ if ( loadedFunction && loadedFunction . func ) {
44
+ return loadedFunction . func ;
45
+ } else {
46
+ throw `Function code for '${ functionId } ' is not loaded and cannot be invoked.` ;
47
+ }
38
48
}
39
49
}
40
50
Original file line number Diff line number Diff line change @@ -24,7 +24,14 @@ export function startNodeWorker(args) {
24
24
25
25
let connection = `${ host } :${ port } ` ;
26
26
systemLog ( `Worker ${ workerId } connecting on ${ connection } ` ) ;
27
- let eventStream = CreateGrpcEventStream ( connection , parseInt ( grpcMaxMessageLength ) ) ;
27
+
28
+ let eventStream ;
29
+ try {
30
+ eventStream = CreateGrpcEventStream ( connection , parseInt ( grpcMaxMessageLength ) ) ;
31
+ } catch ( exception ) {
32
+ exception . message = "Error creating GRPC event stream: " + exception . message ;
33
+ throw exception ;
34
+ }
28
35
29
36
let workerChannel = new WorkerChannel ( workerId , eventStream , new FunctionLoader ( ) ) ;
30
37
You can’t perform that action at this time.
0 commit comments