1

I have a bit of code that sometimes throw errors for different reasons. And I would like to get more informations about it. The problem is either I have nothing at all and my app break or I use try catch and get a whole bunch of stuff from xdebug_message that I can't really show the user.

Let's say I need to do a collection of object AND make sure that some argument is filled (For this case we have nullable=false in the entity). If I miss one of those two points Here is what I get with the following code :

// We create the event $event = new Entity\Event; $event->setType( $this->input->post( 'type' ) ); $event->setDescription( $this->input->post( 'description' ) ); $event->setPlace( $place ); $event->setUser( $user ); // We can now persist this entity: try { $em->persist( $event ); $em->flush(); } catch( \Doctrine\DBAL\DBALException $e ) { // Error When Persisting the Entity !! // 500 Internal Server Error // A generic error message, given when no more specific message is suitable $this->response( array( 'error' => $e ), 500 ); } $message = array( "success" => TRUE ); // Everything is fine $this->response( $message, 200 ); // 200 being the HTTP response code 

In this case, it returns:

{"error":{"xdebug_message":"

What I would like to do is that from this error message, automatically execute some function or send an explicit message to the front side for any configuration possible. I can't really use xdebug here, it is not very helpful for this purpose.

How can I get more explicit details from PHP or Doctrine itself ?

I'm working with Doctrine2 and Codeigniter 2.1 or 2 dont know.

Thanks

3
  • Why on Earth are you running XDebug in production? Commented Sep 30, 2013 at 23:45
  • 1
    I'm not on Production (or I'm not on earth I don't know..) Commented Oct 1, 2013 at 0:28
  • I'm just making some test and trying to build this nicely Commented Oct 1, 2013 at 0:28

1 Answer 1

1

there some function give you nice msg. like $e->getMessage() $e->getCode()

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.