@@ -35,6 +35,10 @@ pub enum CompileError {
3535 node_id : i64 ,
3636 parameter_index : usize ,
3737 } ,
38+ EmptyRemoteService {
39+ node_id : i64 ,
40+ definition_source : String ,
41+ } ,
3842}
3943
4044impl CompileError {
@@ -88,6 +92,17 @@ impl CompileError {
8892 node_id, parameter_index
8993 ) ,
9094 ) ,
95+ CompileError :: EmptyRemoteService {
96+ node_id,
97+ definition_source,
98+ } => RuntimeError :: new (
99+ "T-CORE-000106" ,
100+ "FlowCompileError" ,
101+ format ! (
102+ "Node {} definition_source '{}' does not contain a remote service name" ,
103+ node_id, definition_source
104+ ) ,
105+ ) ,
91106 }
92107 }
93108}
@@ -134,7 +149,7 @@ pub fn compile_flow(
134149 None => None ,
135150 } ;
136151
137- let execution_target = execution_target_for ( & node) ;
152+ let execution_target = execution_target_for ( node_id , & node) ? ;
138153
139154 let mut parameters = Vec :: with_capacity ( node. parameters . len ( ) ) ;
140155 for ( parameter_index, parameter) in node. parameters . iter ( ) . enumerate ( ) {
@@ -198,12 +213,21 @@ pub fn compile_flow(
198213 } )
199214}
200215
201- fn execution_target_for ( node : & NodeFunction ) -> NodeExecutionTarget {
216+ fn execution_target_for (
217+ node_id : i64 ,
218+ node : & NodeFunction ,
219+ ) -> Result < NodeExecutionTarget , CompileError > {
202220 match node. definition_source . as_deref ( ) {
203- None | Some ( "" ) | Some ( "taurus" ) => NodeExecutionTarget :: Local ,
204- Some ( source) if source. starts_with ( "draco" ) => NodeExecutionTarget :: Local ,
205- Some ( service) => NodeExecutionTarget :: Remote {
206- service : service. to_string ( ) ,
221+ None | Some ( "" ) | Some ( "taurus" ) => Ok ( NodeExecutionTarget :: Local ) ,
222+ Some ( source) if source. starts_with ( "draco" ) => Ok ( NodeExecutionTarget :: Local ) ,
223+ Some ( service) => match service. strip_prefix ( "action." ) . unwrap_or ( service) {
224+ "" => Err ( CompileError :: EmptyRemoteService {
225+ node_id,
226+ definition_source : service. to_string ( ) ,
227+ } ) ,
228+ service => Ok ( NodeExecutionTarget :: Remote {
229+ service : service. to_string ( ) ,
230+ } ) ,
207231 } ,
208232 }
209233}
0 commit comments