gmafuken Posted February 27, 2009 Report Share Posted February 27, 2009 (edited) lo que aremos a continuacion sera crear una clase llamada customException que extienda la clase por defecto Exception luego la funcion errormesage Cuando llamamos errores la sentencia es $e->getMessage() u otros asi pero estamos extendiendo la class Exception por lo que quedaran todos los metodos en $this-> class customException extends Exception { public function errorMessage() { //error message $errorMsg = 'Error en la linea '.$this->getLine().'<br><b>'.$this->getMessage().'</b>'; return $errorMsg; } } ejemplo de uso :cafe: creamos un try and catch y usamos throw para capturar el error try{ $start=new core(); if(!$start){ throw new customException($start); //si llegamos aqui ubo exito } }catch(customException $e){ echo $e->errorMessage(); } saludos :) Edited February 27, 2009 by gmafuken Link to comment Share on other sites More sharing options...
electronik_0 Posted February 28, 2009 Report Share Posted February 28, 2009 aprendiste lo que te enseñe men :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now