<commit_before>import 'dart:async';
main() {
  try {
    funcA();
  }
  on Error catch (er, st) {
    print('Error : $er');
    print(st);
    }
  on Exception catch (ex, st) {
    print('Exception : $ex');
    print(st);
    }
}

 funcA() {
  funcB(0);
//  funcC();
//  funcD();
}

// ArgumentError
funcB(x) {
  if(x == 0) throw new ArgumentError('Generated ArgumentError');
}

// IntegerDivisionByZeroException
funcC() {
  int x = 1 % 0;
}

// AsyncError (Bad state: More than one element)
funcD() {
  final testData = ['a', 'b'];
  var stream = new Stream.fromIterable(testData);
  stream.single.then((value){})
    .catchError((e, stackTrace){
      print('AsyncError : ${e}');
      print('Stack Trace : ${stackTrace}');
      });
}<commit_msg>zoned error added<commit_after>import 'dart:async';
main() {
  var funcs = [funcA, funcB, funcC, funcD];
  for (var func in funcs) {
    try{
    func(0);
    }
    on Error catch (e, stackTrace)  {print('Error! $e \nStack Trace :\n$stackTrace');
    }
    on Exception catch (e, stackTrace) {print('Exception! $e \nStack Trace :\n$stackTrace');
    }
  }
}

// ArgumentError
funcA(x) {
  if(x == 0) throw new ArgumentError('Generated ArgumentError');
}

// IntegerDivisionByZeroException
funcB(_) {
  int x = 1 % 0;
}

// AsyncError (Bad state: More than one element)
funcC(_) {
  final testData = ['a', 'b'];
  var stream = new Stream.fromIterable(testData);
  stream.single.then((value){})
    .catchError((e, stackTrace) => print('AsyncError! $e \nStack Trace :\n$stackTrace'));
}

//AsyncError (Same error but caught in a zone)
funcD(_) {
  final testData = ['a', 'b'];
  var stream = new Stream.fromIterable(testData);
  runZoned(() {
    stream.single.then((value){
    });
  },
  onError: (e, stackTrace) => print('AsyncError(zoned)! $e \nStack Trace :\n$stackTrace'));
}
{'fraction_non_alphanumeric': 0.18326039387308535, 'fraction_numerical': 0.00437636761487965, 'mean_word_length': 3.4393203883495147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7280714', 'n_tokens_mistral': 665, 'n_tokens_neox': 655, 'n_words': 166}