There's no way of doing it, you need to put on if/else conditions.
For some special cases I use a "fake" throw exception:
But I don't recommend you on using it, as it generates nasty logger messages, it would be good that they implement a way of doing both:
- Return before the end of the service
- Throw Exceptions
I usually handle this by doing everything that I want to do in the if. So if the condition is not met, the service simply doesn't do anything and the call ends.
In your situation I would use
if ( var > 10 )
// implement your code here
I also usually return some error messages if I need to show UI feedback, when the condition is not met. For example when I need to validate if all required fields have been inputted in a form created with ThingWorx.
Hope this helps,