User Input Exception

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • User Input Exception

    Hallo Community,

    Ich hab wieder mal ein kleines Forum problem: und zwar möchte ich mit throw new UserInputException('error', 'betroffenes_feld'); einen Input Fehler erzeugen.
    Bis jetzt hab ich folgenden Code:

    Quellcode

    1. class UserInputException extends Exception implements PrintableException {
    2. /**
    3. * @name __construct
    4. * @param string $Error
    5. * @param string $InputID
    6. * @access public
    7. * @return void
    8. */
    9. public function __construct($Error = '', $InputID) {
    10. $this->Error = $Error;
    11. $this->InputID = $InputID;
    12. }
    13. /**
    14. * @name Show
    15. * @access public
    16. * @return void
    17. */
    18. public function Show() {
    19. PBF::TPL()->Assign(array(
    20. 'UserException['.$this->InputID.']' => $this->Error,
    21. 'ExceptionInput['.$this->InputID.']' => 'class="RedInput"'
    22. ));
    23. }
    24. }
    Alles anzeigen


    Das Problem ist, dass ich danach nur noch eine weiße Seite sehe. :( Kann mir da einer helfen? ( Wenn ich nur z.B Echo $this->error mache, dann komt nur eine weiße Seite mit dem Error ).

    Danke
    mfg
    Cristalix

    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von Cristalix ()

  • Da du gerade erst mit deinem Framework anfängst. Ich halte es übrigens für eine ganz schlechte Konvention Variablennamen groß zu schreiben - das wird in in keinem mir bekannten PHP Framework so gemacht.
    Außerdem benutze bitte die Syntax Tags für Codehervorhebung

    [syntax="php"] statt [code]

    Zu guter letzt kann man bei deinem Problem recht wenig helfen. Die Exception Klasse sieht nicht verkehrt aus, aber dir fehlt ja die Ausgabe.
    Also wo fängst du den Fehler und gibst ihn aus?
  • Ja, ok aber das ist jetzt Nebensache. ;)

    Ehm so:

    Quellcode

    1. class UserLoginForm {
    2. public function __construct() {
    3. $NewContent = PBF::TPL()->OpenTPLFile('User/UserLoginForm');
    4. if (isset($_POST['submit'])) {
    5. throw new UserInputException('blabla', '0');
    6. }
    7. PBF::TPL()->Assign(array(
    8. 'Content' => $NewContent,
    9. 'ActiveRequestTitle' => PBF::Lang()->__('com.pbb.user.userloginform'),
    10. 'RightContent' => ''
    11. ));
    12. }
    13. }
    Alles anzeigen


    TraceStack:

    Quellcode

    1. #0 /home/www/web396/html/ProBoardForum/PBF/Lib/Util/RequestHandler.class.php(23): UserLoginForm->__construct()
    2. #1 /home/www/web396/html/ProBoardForum/PBF/Lib/Util/RequestHandler.class.php(58): RequestHandler->__construct('UserLogin', 'form')
    3. #2 /home/www/web396/html/ProBoardForum/index.php(10): RequestHandler::HandleRequest()
    4. #3 {main}

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Cristalix ()

  • Klar cacht ich die:

    Quellcode

    1. set_exception_handler(array('PBF', 'HandleException'));


    Quellcode

    1. /**
    2. * @name HandleException
    3. * @param Exception $E
    4. * @access public
    5. * @return void
    6. */
    7. public function HandleException(Exception $E) {
    8. if ($E instanceof PrintableException) {
    9. $E->Show();
    10. exit;
    11. }
    12. }
    Alles anzeigen



    EDIT// Da hab ichs, es liegt am exit; :S
    EDIT2// Doch nicht.. habs raus genommen und ist immer noch weiß.
    mfg
    Cristalix