icebreaker-science / backend

The backend (Spring Boot) part of the icebreaker.science application
Apache License 2.0
2 stars 0 forks source link

Enhancement/refactor exceptions [FIXES #32] #33

Closed osopromadze closed 4 years ago

osopromadze commented 4 years ago

fixes #32

Moved all exceptions into the same package. They are extended from BaseException class. Created messages.properties in resources/i18n folder, and exceptions get error messages from that file. Created global exception handler class and there is constructing final output error object with status code, timestamp and message.

chaoran-chen commented 4 years ago

Hello @osopromadze, thank you very much for this PR! It looks great at a first glance. We will review it in the next few days and give an answer at the beginning of next week.

osopromadze commented 4 years ago

Great @chaoran-chen, thanks for letting me know 👍

chaoran-chen commented 4 years ago

Hi. Would it be possible to remove projectlombok from the dependencies since we are also not using it in the other classes? But the library is very nice and maybe we will introduce it consistently for the whole project at a later point in time.

osopromadze commented 4 years ago

Hi. Would it be possible to remove projectlombok from the dependencies since we are also not using it in the other classes? But the library is very nice and maybe we will introduce it consistently for the whole project at a later point in time.

Yes, no problem, Just added project lombok to easily generate constructros, or getters and setters. Can be removed easily and write code without it.

osopromadze commented 4 years ago

The import in src/test/java/science/icebreaker/device_availability/DeviceAvailabilityServiceTest.java#20 needs to be adapted since the DeviceAvailabilityCreationException was moved. And for consistency, DeviceAvailabilityNotFoundException should also be moved to the science.icebreaker.exception package.

@chaoran-chen done. All tests passed and moved DeviceAvailabilityNotFoundException in exception package.