Jump to content

error while throwing exception


Recommended Posts

While implementing this code for getting secondary groups, 

my localhost instance through this whoops exception: 


Is there something else that I need to do to get this line to work

//\IPS\Output::i()->error( 'node_error', 'YOUR_ERROR_CODE', 404, '' );


It seems it's looking for a template, but a directory doesn't exist?

Link to comment
Share on other sites

On the surface, it appears that the problem is you are attempting to throw an error (the code you commented out) before the dispatcher has actually finished initializing. Because of this, $this->application within the dispatcher has not been set yet, and so later when \IPS\Dispatcher\Front::i()->application->directory is called (during output) it throws an error.

You should essentially never need to throw an actual error message when writing an SSO plugin (which I assume is what you are doing based on the stacktrace you provided). If it is imperative to show an error, you should probably set a session variable or similar, and add another hook later in the code execution that picks this up and shows the error after the dispatcher is initialized.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...