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

Create an Exception for a missing component #13919

Merged
merged 2 commits into from Feb 5, 2017
Merged

Create an Exception for a missing component #13919

merged 2 commits into from Feb 5, 2017

Conversation

mbabker
Copy link
Contributor

@mbabker mbabker commented Feb 4, 2017

Summary of Changes

The base Exception class really shouldn't be thrown, it's too generic and gets caught by too many try/catch blocks. Good practice is to use more specialized exceptions.

In JComponentHelper::renderComponent() an Exception is thrown if the component is missing (either the option parameter is empty, the component is disabled, or the entry point file doesn't exist in the filesystem). I've created a new JComponentExceptionMissing class to represent this error state instead.

Testing Instructions

A request for a non-existing or disabled component should result in a JComponentExceptionMissing object being thrown versus the base level Exception.

Documentation Changes Required

N/A

@Thoert
Copy link

Thoert commented Feb 5, 2017

I have tested this item ✅ successfully on 267b142

Work as expected.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13919.

@wilsonge
Copy link
Contributor

wilsonge commented Feb 5, 2017

I think we should make the default code of the exception should be 404 if it's a component missing

@wilsonge wilsonge merged commit 35ee6ba into joomla:staging Feb 5, 2017
@wilsonge wilsonge added this to the Joomla 3.7.0 milestone Feb 5, 2017
@wilsonge
Copy link
Contributor

wilsonge commented Feb 5, 2017

Looks good now :)

@mbabker mbabker deleted the missing-component-exception branch February 5, 2017 17:38
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.

None yet

4 participants