Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 847795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:50:38+00:00 2026-05-15T06:50:38+00:00

I have a few modules, one is an API. I want to set a

  • 0

I have a few modules, one is an API. I want to set a different ErrorHandler for this API module.

Because when the default ErrorHandler is fired it uses the default module with the default layout, which contains HTML. Which is something I do not want my API to be returning.

I have looked on here and at the Zend Docs and have not come up with anything that allows me to do this.

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:50:39+00:00Added an answer on May 15, 2026 at 6:50 am

    Here is the one I use:

    <?php
    class My_Controller_Plugin_Modular_ErrorController extends Zend_Controller_Plugin_Abstract
    {
        public function routeShutdown (Zend_Controller_Request_Abstract $request)
        {
            $front = Zend_Controller_Front::getInstance();
    
            // Front controller has error handler plugin
            // if the request is an error request.
            // If the error handler plugin is not registered,
            // we will be unable which MCA to run, so do not continue.
            $errorHandlerClass = 'Zend_Controller_Plugin_ErrorHandler';
            if (!$front->hasPlugin($errorHandlerClass)) {
    
                return false;
            }
    
            // Determine new error controller module_ErrorController_ErrorAction
            $plugin = $front->getPlugin($errorHandlerClass);
            $errorController = $plugin->getErrorHandlerController();
            $errorAaction = $plugin->getErrorHandlerAction();
            $module = $request->getModuleName();
    
            // Create test request module_ErrorController_ErrorAction...
            $testRequest = new Zend_Controller_Request_Http();
            $testRequest->setModuleName($module)
                ->setControllerName($errorController)
                ->setActionName($errorAaction);
    
            // Set new error controller if available
            if ($front->getDispatcher()->isDispatchable($testRequest)) {
                $plugin->setErrorHandlerModule($module);
            } else {
    
                return false;
            }
    
            return true;
        }
    }
    

    (BTW, This issue already was discussed here, look carefully.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few modules, but I will focus on one in particular. This
I have some python modules containing mostly functions and a few classes. Each one
I have a package with a few modules, each module has a class (or
I have a few related applications that I want to deploy to different computers.
The situation is this: I want one user group to have one filter as
I wanted to install few modules when my module is installed. How this can
I have a few modules with some functionality overlap. In accordance with DRY, I'd
I have a index.py file which imports a few modules. I later import my
I've heard before that modules are just classes too. I have a few situations,
I have a module that is being used to create only a few page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.