Bug #25816

Improve error handling for invalid types

Added by Robert Lemke about 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
Utility
Start date:
2011-04-07
Due date:
% Done:

100%

PHP Version:
Has patch:
Complexity:

Description

After introducing the Utility\TypeHandling functions, an InvalidArgumentException is thrown if some @var annotation uses a wrong type (and certainly also if invalid types are used elsewhere). However, the exception doesn't (and can't) give any hint where the invalid type was declared.

We have two options to improve this:

1) let the TypeHandling functions return FALSE if the type could not be parsed and throw a proper exception in the calling method
2) let the calling method catch the TypeHandling exceptions and rethrow a better exception

I'm all for solution 1)

Associated revisions

Revision bdcb2420 (diff)
Added by Robert Lemke almost 8 years ago

[BUGFIX] Type declaration errors give hint on root cause

The TypeHandling::parseType() function will now throw a more specific
exception which allows other code parts to display more meaningful
error messages if a variable type was declared wrongly.

Change-Id: I010378956d80b66824bf9012b24ca36a8031c562
Resolves: #25816

History

#1 Updated by Andreas Förthner about 8 years ago

Yes, as I have the same problem here currently: Please go for solution 1! -> I will include that in my serialization changes...

#2 Updated by Sebastian Kurfuerst almost 8 years ago

  • Target version changed from 1.0 beta 1 to 1.0 beta 2

we won't manage this for beta1 anymore, postproning

#3 Updated by Sebastian Kurfuerst almost 8 years ago

  • Tracker changed from Task to Bug

#4 Updated by Mr. Hudson almost 8 years ago

  • Status changed from New to Under Review

Patch set 1 of change I010378956d80b66824bf9012b24ca36a8031c562 has been pushed to the review server.
It is available at http://review.typo3.org/4877

#5 Updated by Robert Lemke almost 8 years ago

  • Category set to Utility
  • Assignee set to Robert Lemke

#6 Updated by Mr. Hudson almost 8 years ago

Patch set 2 of change I010378956d80b66824bf9012b24ca36a8031c562 has been pushed to the review server.
It is available at http://review.typo3.org/4877

#7 Updated by Karsten Dambekalns almost 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF