GithubHelp home page GithubHelp logo

Comments (14)

vasrap avatar vasrap commented on August 25, 2024

Thanks for reporting this. It sounds like a bug. I am gonna work on fix and update this issue when done.

from zf2-restful-module-skeleton.

aramonc avatar aramonc commented on August 25, 2024

Awesome, thank you. Is there anything I can provide to help replicate?

from zf2-restful-module-skeleton.

vasrap avatar vasrap commented on August 25, 2024

Nah, I think what is happening is clear. But I will let you know if it becomes unclear :)

from zf2-restful-module-skeleton.

vasrap avatar vasrap commented on August 25, 2024

@aramonc I have a feeling this is not a bug. Try setting the priority for the "errorProcess" method to something lower (lower than your other error listeners, ie -999). To do that go to Module.php and change method "onBootstrap"; you will see the listener attachment code somewhere in the end of that method.

Let me know.

from zf2-restful-module-skeleton.

jhuet avatar jhuet commented on August 25, 2024

@scaraveos, on my side i tried to change the priority of the listener calling errorProcess to -999 but i still get thrown exceptions showing up as json :(

from zf2-restful-module-skeleton.

vasrap avatar vasrap commented on August 25, 2024

@jhuet do you have anything else listening to the same event?

from zf2-restful-module-skeleton.

aramonc avatar aramonc commented on August 25, 2024

@scaraveos I think this is working as you described. I need to run a couple more tests to be sure, but I think this can be closed & just added to the documentation.

from zf2-restful-module-skeleton.

vasrap avatar vasrap commented on August 25, 2024

Thanks for confirming @aramonc, I will add some more comments on that file.

from zf2-restful-module-skeleton.

chris-- avatar chris-- commented on August 25, 2024

@scaraveos I'm also having problems with the errorProcess taking over despite having set the priority to -999. I'm just getting into ZF2, so my solution is just a hack:
add

public function errorProcess(MvcEvent $e)
{
    $routeMatch = $e->getRouteMatch();
    if (!$routeMatch) {
        return null;
    }
....

I am using the ZF2 skeleton app and changed the route in module/Main/config/module.config.php to '/rest/:controller[.:formatter][/:id]'. Thanks for you work!

from zf2-restful-module-skeleton.

vasrap avatar vasrap commented on August 25, 2024

@chris-- Do you have anything else listening to the "MvcEvent::EVENT_DISPATCH_ERROR" event? If not then "errorProcess" will always handle that event.

from zf2-restful-module-skeleton.

aramonc avatar aramonc commented on August 25, 2024

@scaraveos that makes sense. Is there any way to have it do the default other than what @chris-- did?

from zf2-restful-module-skeleton.

chris-- avatar chris-- commented on August 25, 2024

@scaraveos I dont really understand how the error delegation works in the zf skeleton but I dont think there is anything listening on that event.

from zf2-restful-module-skeleton.

vasrap avatar vasrap commented on August 25, 2024

@aramonc if I understood you correctly; essentially what @chris-- did is handled at line 129 in Module.php in a different way though.

from zf2-restful-module-skeleton.

trainerbill avatar trainerbill commented on August 25, 2024

I tried all of the work arounds listed in this thread and nothing worked for me. I decided to check the headers for Accept text/html. If it finds that header it will return null out of the errorProcess function and display HTML view model. Here is the commit https://github.com/UNOIS/RestfulApiModule/commit/8bbcd4c54a28492a60b92d3f6efb4eb674de3a91

from zf2-restful-module-skeleton.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.