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

PostType class should throw an exception if $slug is not defined. #17

Open
jmichaelward opened this issue May 1, 2019 · 1 comment
Open
Labels
good first issue Good for newcomers priority: P1 This is an important issue, but not critical size: small Issue should take less than 4 hours to complete

Comments

@jmichaelward
Copy link
Contributor

PostType objects do not currently throw an exception if a $slug property is not defined, which can be confusing to developers when trying to extend the PostType class.

The Taxonomy class runs a requirements check before attempting to register a taxonomy, which alerts developers if the $slug or $object_types properties are missing. That implementation probably needs a little work (clearly the conditional in the register method there never actually passes if an exception is thrown), but it could serve as a model for how to address this missing exceptions in the PostType class. See: https://github.com/WebDevStudios/oops-wp/blob/master/src/Structure/Content/Taxonomy.php#L53

@jmichaelward jmichaelward added good first issue Good for newcomers priority: P1 This is an important issue, but not critical size: small Issue should take less than 4 hours to complete labels May 1, 2019
@oddevan oddevan self-assigned this Feb 28, 2020
@oddevan
Copy link

oddevan commented Feb 28, 2020

Looking at this as I'm also looking to add some content types soon.

Do we want to use the generic \Exception like the Taxonomy class is, or do we want to create some specialized exceptions?

@oddevan oddevan removed their assignment Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers priority: P1 This is an important issue, but not critical size: small Issue should take less than 4 hours to complete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants