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

Throw exception instead of using fatal #11719

Merged
merged 1 commit into from
Feb 26, 2018
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Feb 26, 2018

Overview

Minor code improvement - use exception rather than fatal

Before

CRM_Core_Error::fatal($message); shows the below regardless of whether debugging is enabled
screenshot 2018-02-26 13 29 14

After

screenshot 2018-02-26 18 52 28

Technical Details

In general we are working towards deprecating 'fatal' - in this case we can convert it to an exception & add handling to the exception to improve user experience

Comments

Note that I replicate this error when debugging but have not seen the duplicate contribution error 'out in the wild' - to replicate in debugging start doing a contribution, kill half way through & then re-submit.

@colemanw @seamuslee001 @monishdeb would be good to get your thoughts on this (ps. I bet @mattwire has hit this error!)

Duplicate contributions are a really not handled well anywhere in the form layer.
The CRM_Core_Error winds up using the fatal template, which has the same end
result for form users as if an exception were thrown, let's switch.

Note that this appears to be the only scenario when an error would
be returned so we can simply drop that handling
@colemanw
Copy link
Member

Looks like a sensible, safe change.

@colemanw colemanw merged commit 716dc78 into civicrm:master Feb 26, 2018
@mlutfy mlutfy added this to the 4.7.32 milestone Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants