Skip to content

Commit

Permalink
Update checklist.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KseniiaMakarova authored May 1, 2023
1 parent 5d821f2 commit 15518b2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,27 @@
* Let's check instances map before new instance creation.
* Make Interface Implementations map a class field. You can fill it in using `Map.of()`.
* When throwing an exception add an informative message to it. Also, don't forget to add an exception you're catching in `catch` block to the `RuntimeException` object you throw
```
Bad example:

Bad example:
```java
} catch(Exception e) {
throw new SomeException("Can't initialize object with Injector");
}
```
```
Good example:
Good example:
```java
} catch(Exception e) {
throw new SomeException("Injection failed, missing @Component annotaion on the class " + someInfoAboutClass, e);
}
```
* It is better to replace many exceptions that have a common parent with a general parental exception.
```
Bad example:

Bad example:
```java
} catch (InvocationTargetException | InstantiationException
| IllegalAccessException | NoSuchMethodException e) {
```
```
Good example:
Good example:
```java
} catch (ReflectiveOperationException e) {
```

0 comments on commit 15518b2

Please sign in to comment.