Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing Exceptions with _doing_it_wrong #2

Open
Chrico opened this issue Jun 3, 2016 · 2 comments
Open

Replacing Exceptions with _doing_it_wrong #2

Chrico opened this issue Jun 3, 2016 · 2 comments
Assignees
Milestone

Comments

@Chrico
Copy link
Member

Chrico commented Jun 3, 2016

Since this package is designed to fit into a WordPress-envoirment, Exceptions could lead to broken sites (WordPress does not handle Exceptions by default).

Exception in set_options
Maybe we should change the behavior of set_options from throwing an InvalidArgumentException to a more "wordpressy"-way by using _doing_it_wrong() and not setting the given configuration to the $options-array.

Usage of _doing_it_wrong in Inpsyde\Filter\WordPress
The other point which has to be discussed is the _doing_it_wrong in Inpsyde\Filter\WordPress folder, when a incorrect $value-type is given. I think just returning the value and triggering a _doing_it_wrong seems to be ok, since WordPress does nothing (no error message, just continue with something similar or even break) against wrong values.

@Chrico Chrico self-assigned this Jun 3, 2016
@Chrico Chrico modified the milestone: 1.1 Jun 3, 2016
@dnaber-de
Copy link
Member

dnaber-de commented Jun 3, 2016

Do you really want to bind all these nice logic to a WordPress-only content? The question is, whether you want to force developers to deal with this exceptions. For what I see, the most exceptions are about logical errors, meaning these should lead directly to a change in the client code.

However, maybe it's somehow possible to handle the exceptions internally of Inpsyde\Filters within a wrapper that then delegates these exceptions to _doing_it_wrong().

@Chrico
Copy link
Member Author

Chrico commented Jun 3, 2016

Thanks for your feedback @dnaber-de !

I like the "throw Exception if something is not correct"-approach. The "wordpressy"-way is too soft, hard to debug and not really secure ("oh something wrong is given..no problem, i just continue with something similar/else"). WordPress does not stop the program when something is really incorrect.

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

No branches or pull requests

2 participants