feature: improved handling exception NoSuchElementException

This commit is contained in:
Ершов Владислав
2026-08-31 22:56:53 +07:00
parent fad97d8e95
commit 3cca9402bb
2 changed files with 2 additions and 2 deletions
@@ -34,7 +34,7 @@ public class FileDataSource implements DataSource{
return null;
}
catch (NoSuchElementException e){
System.out.println("No such element");
System.out.println(e.getMessage() + "No such element");
return null;
}
}
@@ -56,7 +56,7 @@ public class StudentCsvReader implements Iterator<Student> {
public Student next() {
lineOfFile++;
if (!records.hasNext()) {
throw new NoSuchElementException();
throw new NoSuchElementException("Problem at line " + lineOfFile + ".");
}
CSVRecord record = records.next();