Skip to content

Create CrawlerConfigurationException Specialization. Avoid throw Exception.#149

Open
gustavofoa wants to merge 1 commit intoyasserg:masterfrom
gustavofoa:master
Open

Create CrawlerConfigurationException Specialization. Avoid throw Exception.#149
gustavofoa wants to merge 1 commit intoyasserg:masterfrom
gustavofoa:master

Conversation

@gustavofoa
Copy link
Copy Markdown

I had to fix a sonar constraint ("Avoid catch Exception") in my project because the CrawerController constructor throws a pure Exception.

I hope that this contribution is useful.

@Chaiavi
Copy link
Copy Markdown
Contributor

Chaiavi commented Aug 9, 2016

Thank you Gustav.

Yasser, this pull request looks good and can be merged

@rzo1
Copy link
Copy Markdown
Contributor

rzo1 commented Dec 15, 2016

This makes sense to me... if we go for the next release version, this will be a benefit to pass the automated reviews...

Maybe @s17t can look at this...

@dgoiko
Copy link
Copy Markdown

dgoiko commented Jan 26, 2020

I made a similar pull request after you, did't saw this.

Anyway, I think there's much more with exception declaration to be done. CrawlController constructor, for instance, claims to throw a bare exception, but there are like 5 checked exceptions and 10-15 unchecked thrown by instructions inside. Should he wrap them in an unchecked common exception? Maybe a ControllerInstantiationException? That would require more CPU to capture and filter causes.

Exceptions, error codes and so on have allways been a matter of discussion. The problem with catching a bare Exception is that you'll get runtimes and every other exception. Some times, by catching runtime before exception youn avoid style warnings, it depends on the checks performed.

Anyway, keep in mind that introducing new exceptions to substitute plain Exceptions may cause copde using this lkibrary to wrongly identify the errors ocured. Most people will leave it for a major version change: People are alñready catching Exceptions, so the coded will not show any errors due to new exceptions not being caught.

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.

4 participants