Skip to content

TryParse static method should catch all types of exception? or not? #24

Description

@jsakamoto

Hi everyone, and contributors of this library:

Few days ago, @zijianhuang said "TryParse static method should not catch all types of exception." with pull request #23 that contains commit:e3a7917.

His comment is:

For the sake of defensive programming and safety, library code should not catch "all of types (any Exceptions)". Catching general exception should be the job of the application and CLR. Major platforms like WinForms, WPF, WCF and MVC etc. have built-in mechanism of catching uncaught exceptions. It is the responsibility of the application developers to utilize those mechanisms built-in.

(Source: Some slight QA fixes in 2 commits #23)

I partially agree his opinion. I always feel it is "foolish" that catching all types without much thought.

But, another point of view, we had an experience that ran into really unexpected type of exception caused by the mistake of my implementation. ( See also #7 and #5 ).

What should I do?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions