Skip to content

Conversation

@iamAlimzhan
Copy link

No description provided.

@@ -0,0 +1,7 @@
package task_1.solution;

public class TimeTravelException extends Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше unchecked
extendes RuntimeException

@@ -0,0 +1,25 @@
package task_1.solution;

public class TimeTraveler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рассмотреть использования lombok


if (year < timeTraveler.getBirthYear()) {
throw new TimeTravelException("The year of travel to the past is less than the year of the traveler's " +
"birth.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавить информацию о путешественнике во времени

@@ -0,0 +1,17 @@
package task_1.solution;

public class Main {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slf4j из lombok даст log объект

timeMachine.travelInTime(traveler1, 2000);
timeMachine.travelInTime(traveler2, 2075);
} catch (TimeTravelException e) {
System.out.println("Произошла ошибка: " + e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не логируется stacktrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants