I'm learning Zend and trying to set a custom view but I'm having trouble.
class AccountController extends Zend_Controller_Action
{
public function init() {}
public function indexAction()
{
$this->view->setScriptPath(APPLICATION_PATH . '/views/scripts/mobile/');
$this->view->render('iphone.phtml');
}
}
The path is correct for the iphone.phtml view. I keep getting this error:
Fatal error: Uncaught exception 'Zend_View_Exception' with message 'script 'error/error.phtml' not found in path (/Users/frankie/Websites/learn/zend/project1/application/views/scripts/mobile/)' in /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/View/Abstract.php:988 Stack trace: #0 /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/View/Abstract.php(884): Zend_View_Abstract->_script('error/error.pht...') #1 /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/Controller/Action/Helper/ViewRenderer.php(900): Zend_View_Abstract->render('error/error.pht...') #2 /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/Controller/Action/Helper/ViewRenderer.php(921): Zend_Controller_Action_Helper_ViewRenderer->renderScript('error/error.pht...', NULL) #3 /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/Controller/Action/Helper/ViewRenderer.php(960): Zend_Controller_Action_Helper_ViewRenderer->render() #4 /Users/frankie/Websites/Libraries/ZendFr in /Users/frankie/Websites/Libraries/ZendFramework-1.11.10/library/Zend/Controller/Plugin/Broker.php on line 336
I changed 'setScriptPath' to 'addScriptPath' and it no longer gives the error but totally ignores the $this->view->rendder
It's $this->render() And not $this->view->render()
In addition to yokoloko's answer, your error handling is not configured properly. It's catching your exceptions and trying to display a friendly error, but you don't have the friendly templates set up.
You should really create the views/scripts/error/error.pthml template, or turn on exceptions for your application again. (for the development environment).
resources.frontController.throwExceptions = true
(or similar)
Related
I've run into the dreaded Reflection.emit issue in my webplayer build and am unable to locate what is triggering it. I'm currently commenting out code method by method and rebuilding to locate the cause and have narrowed it down to the below.
I'm not using JSON so the various JSON libraries aren't the cause, nor any of the other result suggestions returned by google.
How can i more easily go about locating the cause of this error. I have full stack trace on and well as full debugging, but all i get is the following console output.
NotSupportedException: C:\Program Files\Unity 2018.2.0b2\Editor\Data\il2cpp\libil2cpp\icalls\mscorlib\System.Reflection.Emit\AssemblyBuilder.cpp(20) : Unsupported internal call for IL2CPP:AssemblyBuilder::basic_init - System.Reflection.Emit is not supported.
Rethrow as TypeInitializationException: The type initializer for 'System.Reflection.Emit.DynamicMethod.AnonHostModuleHolder' threw an exception.
//NOTE: appM.procM is a C# .Net 4.x dynamic variable EG:
//public dynamic procM = GetProcClass(strProcName)
public void ShowProcList() {
/* Rest of method commented out*/
if(appM.procM == null){
procList.Initialize(appM.procM.lstNames, this);
}
/* Rest of method commented out*/
}
public void Initialize(List<string> lstNames, UIM um, string currProc=null) {
uiM = um;
//cleanup of the list before populating
foreach(Transform fld in Panel.transform) {
Destroy(fld.gameObject);
}
/* Rest of method commented out*/
}
Update: I narrowed down the problem line of code, but haven't closed the question as there's got to be an easier way than commenting out line by line and rebuilding.
For future searchers, the issue is the if(appM.procM == null) check. As procM is a dynamic variable reflection is used which kills AOT in webGL builds. No compiler warnings were generated to save myself from myself.
Nevermind, i am an idiot, The option Enable Exceptions under Player Settings was set to Full Without Stacktrace and not Full with Stacktrace.
The value Full With Stacktrace contains the pertinent data. Easily locatable in the browsers console. Warning that full debugging does increase build times and slow down the application.
Consider this code:
func doSomething() throws {
try callThrowingFunction1()
try callThrowingFunction2()
}
func userAction() {
do {
try doSomething()
} catch {
// display and log error
}
}
Say those inner functions can throw the same kind of errors and I would like to know if an error occurred in callThrowingFunction1() or in callThrowingFunction2().
As long as I'm in the debugger I can set a breakpoint for Swift errors on swift_willThrow, but if I would like to log the call stack on a user device, is there a way to do that?
Swift errors have no such thing as stack-trace yet (if will ever), and even Xcode can show stack-trace only if the error is un-handled by our code (and gets caught by Xcode directly instead).
Alternativly, your custom Error's constructor can store the stack-trace for later use, but in most cases errors are not custom, where you can't alter error's constructor (like errors of 3rd-party library).
But we can at least print stack-trace of where error(s) get catched, like:
do {
try ... // something that throws goes here
} catch let error as NSError {
print("Error: \(error)")
println(NSThread.callStackSymbols())
}
Exception breakpoint
If you just want to debug, without need to upload stack-trace to server, then Xcode's "Exception breakpoint" feature can help, like:
First place a normal-breakpoint near the failing logic.
Wait until Xcode pauses App on that line, enable Xcode's feature:
Finally, resume App, and wait untill exception is thrown.
Images are old, nowadays you see "Add Swift Error Breakpoint" or something like that as well (beside "Add Exception Breakpoint" option).
Today I did couple of updates on the front-end side of things, and then I did get the execution exception error, while running the app, that points to the written code within the target folder.
Error:
Execution exception
[IllegalStateException: java.lang.reflect.InvocationTargetException]
Pinter to the error on line 31 (/target/scala2.11/routes/main/controllers/ReverseRoutes.scala:31):
28 // #LINE:65
29 def versioned(file:Asset): Call = {
30 implicit val _rrc = new ReverseRouteContext(Map(("path", "/public")))
31 Call("GET", _prefix + { _defaultPrefix } + "vassets/" + implicitly[PathBindable[Asset]].unbind("file", file))
32 }
Where should I look for this error, as obviously I did not wrote the code within the target folder.
Note 1: Commented whatever I did after I did get the error, and I do still get the error.
Note 2: I did clean compile with no error, however when I try to run it through the browser I do get the error.
this error is strictly connected with template and using controllers call (your methods from controllers)
you have to localize on your template which controller method calls this error
for instance I had a problem with nullpointerexception and I found a problem. I had below controller:
#controllers.MyController.myMethod(object.getValue)
and it turns out that in db getValue had null and play reported it as a problem. he somehow detect that this value is null
Strange for me but maybe it will help
I know there are lots of such questions here and most of them are answered. But the answers just won't solve my case.
I'm working on an eclipse plugin project, have a customized project type which can be either run or debugged. I have implemented the run and debug function and everything I expected are displayed on the screen, except the console shows an exception:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2015-04-28 23:31:17.410
!MESSAGE Internal error during tool item enablement updating, this is only logged once per tool item.
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4441)
at org.eclipse.swt.SWT.error(SWT.java:4356)
at org.eclipse.swt.SWT.error(SWT.java:4327)
at org.eclipse.swt.widgets.Widget.error(Widget.java:783)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:574)
at org.eclipse.swt.widgets.Widget.getData(Widget.java:874)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.updateIcons(HandledContributionItem.java:546)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.update(HandledContributionItem.java:440)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.update(HandledContributionItem.java:430)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$3.run(HandledContributionItem.java:168)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.updateItemEnablement(HandledContributionItem.java:196)
at org.eclipse.e4.ui.workbench.renderers.swt.ToolItemUpdater.updateContributionItems(ToolItemUpdater.java:39)
at org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer$8.changed(ToolBarManagerRenderer.java:367)
at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:110)
at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:338)
at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:352)
at org.eclipse.ui.internal.services.EvaluationService.contextEvaluate(EvaluationService.java:139)
at org.eclipse.ui.internal.services.EvaluationService.addSourceProvider(EvaluationService.java:180)
at org.eclipse.debug.internal.ui.contexts.DebugContextSourceProvider.<init>(DebugContextSourceProvider.java:51)
at org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.<init>(DebugWindowContextService.java:62)
at org.eclipse.debug.internal.ui.contexts.DebugContextManager.createService(DebugContextManager.java:163)
at org.eclipse.debug.internal.ui.contexts.DebugContextManager.getContextService(DebugContextManager.java:221)
at org.eclipse.debug.internal.ui.views.ViewContextService.<init>(ViewContextService.java:620)
at org.eclipse.debug.internal.ui.views.ViewContextManager.windowOpened(ViewContextManager.java:93)
at org.eclipse.debug.internal.ui.views.ViewContextManager.<init>(ViewContextManager.java:55)
at org.eclipse.debug.internal.ui.views.ViewContextManager.getDefault(ViewContextManager.java:44)
at org.eclipse.debug.internal.ui.contexts.DebugContextManager.getDefault(DebugContextManager.java:150)
at org.eclipse.debug.ui.DebugUITools.getDebugContextManager(DebugUITools.java:1068)
at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupService.<init>(SourceLookupService.java:40)
at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupManager.windowOpened(SourceLookupManager.java:91)
at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupManager.<init>(SourceLookupManager.java:41)
at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupManager.getDefault(SourceLookupManager.java:53)
at org.eclipse.debug.internal.ui.DebugUIPlugin.initializeLaunchListeners(DebugUIPlugin.java:935)
at org.eclipse.debug.internal.ui.DebugUIPlugin.launchAdded(DebugUIPlugin.java:920)
at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.run(LaunchManager.java:451)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.notify(LaunchManager.java:438)
at org.eclipse.debug.internal.core.LaunchManager.fireUpdate(LaunchManager.java:1044)
at org.eclipse.debug.internal.core.LaunchManager.addLaunch(LaunchManager.java:708)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:834)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
My codes are as following: In LaunchShortCut.java I have
Display.getDefault().syncExec(new Runnable() {
#Override
public void run() {
Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if(DebugUITools.openLaunchConfigurationDialog(activeShell, config, group, null) == Window.CANCEL){
return;
}
}
});
This trigger the LaunchConfigurationWindow, and does not show any exception in console. When I hit the "run" in this window, the process stops at the first line in the following code where I have a breakpoint, and shows the exception in the console.
Display.getDefault().syncExec(new Runnable() {
#Override
public void run() {
//clear old output
HTMLOutput htmloutput = (HTMLOutput) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("my.view.id");
}
}
From the stack trace of the exception I don't see anything related to my code. If I let the program go on running, everything is fine, I don't see any trouble this exception causes, but I just can't figure what's it about and can't even stop it from showing up. Please help me on this issue.
It seems that you've hit a bug in Eclipse. The same stacktrace is described in Bug 445560. Chances are that the workaround described in this bug report (see comment 4) also helps in your case:
As current local workaround for this issue I've added in our rcp code an early call to DebugUITools.getDebugContextManager() from the UI thread.
Ugly, and should not be needed, but it avoids the failures seen when launching for the first time.
I'm developing an application, everything works fine but sometimes i get the following error:
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /usr/share/php/libzend-framework-php/Zend/Session.php:462 Stack trace: #0 /usr/share/php/libzend-framework-php/Zend/Session/Namespace.php(143): Zend_Session::start(true) #1 /var/vhosts/rmanager.vsnetwork.net/application/views/helpers/GetProjetoNome.php(7): Zend_Session_Namespace->__construct('rmanager') #2 [internal function]: Zend_View_Helper_GetProjetoNome->GetProjetoNome() #3 /usr/share/php/libzend-framework-php/Zend/View/Abstract.php(342): call_user_func_array(Array, Array) #4 /var/vhosts/rmanager.vsnetwork.net/application/layouts/scripts/layout.phtml(73): Zend_View_Abstract->__call('GetProjetoNome', Array) #5 /var/vhosts/rmanager.vsnetwork.net/application/layouts/scripts/layout.phtml(73): Zend_View->GetProjetoNome() #6 /usr/share/php/libzend-framework-php/Zend/View.php(108): include('/var/vhosts/rma...') #7 /usr/share/php/libzend-framework-php/Zend/View/Abstract.php(880) in /usr/share/php/libzend-framework-php/Zend/Session.php on line 462
If i refresh the page, it works.
Sometimes it returns me the error while i send post to the same page
I'm using Zend_Auth and Zend_Acl inside a plugin and Zend_Namespace in various places of my application.
Does anyone has idea why it is happing?
Thanks
It's kinda hard to help you with so little information, but as far as i read ealier this week when i play with session_namespace, you have to be very careful with it.
This paragraph has been very helpful for me
Don't ever start the session explicitly. Just use it automatically. I also use Zend_Auth and Zend_Sesison_Namespace many times but that error never comes.