Bug #2244

Exception is not catchable. Exception is still shown after throwStatus

Added by Christoph Blömer over 6 years ago. Updated almost 5 years ago.

Status:Closed Start date:2008-11-29
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Error
Target version:-
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

If I excecute the following code in FLOW3 a F3::PHPCR::NodeType::NoSuchNodeTypeException is thrown:

$taskManagement1 = $this->objectFactory->create('F3::TaskManagement::Domain::TaskManagement');
$taskManagement1->setName('TheTaskManagement');
$this->taskManagementRepository->add($taskManagement1);

Then I tried to catch the Exception which is thrown and throw a status.

try {
$taskManagement1 = $this->objectFactory->create('F3::TaskManagement::Domain::TaskManagement');
$taskManagement1->setName('TheTaskManagement');
$this->taskManagementRepository->add($taskManagement1);
} catch(F3::PHPCR::NodeType::NoSuchNodeTypeException $e) {
$this->throwStatus(500);
}

Result: This does not work and no "500 Internal Server Error" is shown. Only the Exception itself.

After that I added the throwStatus(500) outside the catch-block to check if that works.
Result:The Status "500 Internal Server Error" is shown but also the exception appears.
Is this the correct behavier, that the exception is still shown after throwing the status?

History

#1 Updated by Karsten Dambekalns over 6 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Karsten Dambekalns

Works for me with the current FLOW3, i.e. throwStatus() masks an exception in development and production context. Is this still an issue?

#2 Updated by Karsten Dambekalns over 6 years ago

internal note: "soweit ich noch weiß ist die sache die: das der catch block mit F3::PHPCR::NodeType::NoSuchNodeTypeException $e nicht funktionierte. es ging nicht um throwStatus. es war einfach nicht möglich die exception abzufangen."

#3 Updated by Christoph Blömer over 6 years ago

I can not reproduce it. I think the problem is gone. Maybe I should have asked for ::F3::PHPCR::NodeType::NoSuchNodeTypeException.
This was in Beta 1 or 2 and now the namespace syntax has changed and you have to ask for \F3\PHPCR\NodeType\NoSuchNodeTypeException.

I would say this bug is resolved.

#4 Updated by Karsten Dambekalns over 6 years ago

  • Status changed from Needs Feedback to Closed
  • % Done changed from 0 to 100

Closed as 'no change required'

Also available in: Atom PDF