Skip to content

Conversation

@Magnus-droid
Copy link

No description provided.

@Magnus-droid
Copy link
Author

I know the throw and catch system I made makes the code a lot more complicated than it needs to be, and I would never do this if this task was not a practice exercise and I actually had to write good code that's easy to maintain. I just wanted to play around, and experiment with exception and exception handling because I had some spare time. I apologize for this code haha

try {
Product toReturn = this.theProducts.updateProduct(id, product);
if (toReturn == null) {
throw new IllegalArgumentException("Item already exists");

Choose a reason for hiding this comment

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

I'm not sure this IF statement and the corresponding exception is correct...

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