Why does try {} catch{} not work?
Permalink
I see a bug report that this was fixed in 2007. However, in my member function in a C5 namedspaced class I do this:
function funcname() {
Log::addEntry("started .. ", NULL);
try {
Log::addEntry("inside try ...", NULL);
throw new \AccessDeniedException('test');
Log::addEntry("after exception ...", NULL);
}
catch (\Exception $e) {
Log::addEntry("error trapped", NULL);
Log::addEntry("error: " . $e->getMessage(), NULL);
}
Log::addEntry("after try ...", NULL);
}
The only log entries are "started .. " and "inside try ..."
Then poof all execution stops.
Ideas Please.
Sean
function funcname() {
Log::addEntry("started .. ", NULL);
try {
Log::addEntry("inside try ...", NULL);
throw new \AccessDeniedException('test');
Log::addEntry("after exception ...", NULL);
}
catch (\Exception $e) {
Log::addEntry("error trapped", NULL);
Log::addEntry("error: " . $e->getMessage(), NULL);
}
Log::addEntry("after try ...", NULL);
}
The only log entries are "started .. " and "inside try ..."
Then poof all execution stops.
Ideas Please.
Sean
If you check your PHP Error log after hitting this is there anything there? It's possible that either the AccessDeniedException isn't being called with the correct namespace or it's not being caught correctly.
Thank you!
I am new to PHP so that did not occur to me.
Since this is a hosted site, I have asked how to get to it.
Sean
I am new to PHP so that did not occur to me.
Since this is a hosted site, I have asked how to get to it.
Sean
Any ideas, please?
PHP just dies (this is in a function called within an ajax call) and I cannot get any error messages. This is making debugging a SOAP call super difficult.
Is this a C5 or PHP problem?
Thanks,
Sean