File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/WorkflowCore.DSL/Services Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,18 @@ void primitiveAction(IStepBody pStep, object pData)
252252 if ( stepProperty . PropertyType . IsAssignableFrom ( primitiveValue . GetType ( ) ) )
253253 stepProperty . SetValue ( pStep , primitiveValue ) ;
254254 else
255- stepProperty . SetValue ( pStep , System . Convert . ChangeType ( primitiveValue , stepProperty . PropertyType ) ) ;
255+ try
256+ {
257+ stepProperty . SetValue ( pStep , System . Convert . ChangeType ( primitiveValue , stepProperty . PropertyType ) ) ;
258+ }
259+ catch ( InvalidCastException ex )
260+ {
261+ throw new ArgumentException ( $ "Failed to convert input '{ input . Key } ' for step '{ source . Id } ' to type '{ stepProperty . PropertyType . Name } '.", ex ) ;
262+ }
263+ catch ( FormatException ex )
264+ {
265+ throw new ArgumentException ( $ "Failed to convert input '{ input . Key } ' for step '{ source . Id } ' to type '{ stepProperty . PropertyType . Name } '.", ex ) ;
266+ }
256267 }
257268 step . Inputs . Add ( new ActionParameter < IStepBody , object > ( primitiveAction ) ) ;
258269 continue ;
You can’t perform that action at this time.
0 commit comments