- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
sprint 9 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sprint 9 #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Привет, Валерий , спасибо за PR
В целом все супер :)
Есть совсем небольшие замечания, посмотри комментарии ниже, пожалуйста
| @@ -0,0 +1,7 @@ | |||
| package ru.yandex.practicum.filmorate.exception; | |||
|  | |||
| public class FilmNotFoundException extends RuntimeException{ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А необходимо ли тут (и ниже) непроверяемое исключение?
Пользователь ввел некорректные данные, фильм не найден и т.д. и т.п. - вполне себе штатная ситуация, пусть тут будет проверяемое исключение :)
extends Exception
| } | ||
|  | ||
| public void like(long filmId, long userId){ | ||
| if (filmStorage.getById(filmId).isPresent()){ | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут можно сделать несколько короче, раз уж Optional :)
ifPresent(...).orElseThrow()
| log.debug("film.getName().isEmpty(): {}", film.getName()); | ||
| return false; | ||
| } | ||
| if (film.getName().isBlank()) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут можно использовать
StringUtils.hasText
или же аналогичную функцию из apache commons
StringUtils.isNotBlank
=)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Все супер, спасибо!
PS про исключения посмотри во  это, может пригодиться :)
https://habr.com/ru/post/528116/
No description provided.