skpIf method
void
skpIf(})
if you want interrupt the normal flow, but not trigger runCatching.onFailure
condition
true: throw SkipError with reason
level
Level.FINE, (default) will not print by default Logger.root.level = Level.INFO;
runCatching((){
skpIf(true,'interrupt by xxx reason, and this is not failure'); // throw, but on catching
return 'ok';
},
onFailure: (e,s){
print('$e; $s'); // will not print SkipError
});
ref runCatching.ignoreSkipError
Implementation
@visibleForTesting
@protected
void skpIf(bool condition, String reason, {Level level = Level.FINE}) =>
condition ? throw SkipError(reason, level: level.value) : null;