Source for file ExceptionInSylar.php

Documentation is available at ExceptionInSylar.php

  1. <?php
  2. /*
  3. * This file is part of Sylar.
  4. *
  5. * Sylar is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Sylar is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with Sylar. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * @copyright Copyright Sylar Development Team
  19. * @license http://www.gnu.org/licenses/ GNU Public License V2.0
  20. * @see https://launchpad.net/sylar/
  21. * @see http://www.giano-solutions.com
  22. */
  23.  
  24. /** Include the class ConfigBox */
  25.  
  26. import('sylar.common.system.ConfigBox');
  27. import('sylar.common.system.Logger');
  28.  
  29.  
  30. /**
  31. * ReDefine a custom exception class for Sylar system
  32. *
  33. * @todo To be done!
  34. *
  35. * @package Sylar
  36. * @version 1.0
  37. * @since 12-2004
  38. * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
  39. * @copyright Sylar Development Team
  40. */
  41. class ExceptionInSylar extends Exception{
  42. /**
  43. * Redefine the exception so message isn't optional
  44. */
  45. public function __construct($message, $code=0) {
  46. #
  47. # Custom cose
  48. #
  49. //TODO to be done
  50. $message = "[SylarException n: ".$code."] ".$message;
  51. // make sure everything is assigned properly
  52. parent::__construct($message, $code);
  53. }
  54.  
  55. /**
  56. * format the exception description for storage in Log
  57. *
  58. * @todo to be done
  59. *
  60. * @return string
  61. */
  62. public function getMessageForLog(){
  63. $msg = parent::getMessage();
  64. $msg .= "Stack:\n ";
  65. //$aStakTrace = parent::getTrace();
  66. foreach (parent::getTrace() as $sItem) {
  67. foreach ($sItem as $k=>$v){
  68. $msg .= $k." = ".$v."\n";
  69. }
  70. $msg .= "\n\n";
  71. }
  72. return $msg;
  73. }
  74. /**
  75. * it logs directly the exceptions with Logger
  76. */
  77. public function logException(){
  78. //TODO To be done
  79. }
  80. /**
  81. * custom string representation of object
  82. */
  83. public function __toString() {
  84. return "[Sylar Exception toString: \n";
  85. //TODO To be done
  86. }
  87.  
  88. }
  89. ?>

Documentation generated on Thu, 24 Apr 2008 16:14:14 +0200 by phpDocumentor 1.3.0RC3