0

Give Error precautions with possible reasons

Hi yahoo,

It will be the good and very handy help for all blueprint developers that yahoo provide List of possible errors that may occur,their possible reasons so that we can take precautions,And possible help and steps how to resolve them.

I know errors can not be determined before and removing them will be good R & D.But still all common errors we can avoid...isn't it.

So waiting for the day when yahoo may think on that...and make developer's work easy and keep development work interesting and exciting...........

Thanks

Uday

by
2 Replies
  • If you use the Blueprint.php class, there's this function that helps you identify which line of code that causes an error (in PHP):
    CODE
    	function blueprintErrorHandler( $errno, $errstr, $errfile, $errline )
    {
    if ( $errno == E_USER_ERROR )
    {
    // Make sure we set the right content type
    header( "Content-Type: application/ x-ywidget+xml" );

    // Make sure not to cache. The Java client really cares.
    header( "Cache-Control: no-cache" );

    $writer = new XMLWriter();
    $writer->openMemory();
    $writer->setIndent( true );
    $writer->startDocument('1.0','UTF-8');

    $page = new Blueprint_Page();
    $page->setHeader(new Blueprint_SimpleHeader( "Error - ".htmlentities( $errno ) ) );
    $module = new Blueprint_Module();
    $page->addModule( $module );
    $module->addContent( new Blueprint_Block( htmlentities( $errstr ) ) );
    $module->addContent( new Blueprint_Block( "File: ".htmlentities( $errfile ) ) );
    $module->addContent( new Blueprint_Block( "Line: ".htmlentities( $errline ) ) );

    $page->Emit( $writer );
    print( $writer->outputMemory() );
    exit();
    }
    }
    set_error_handler( "blueprintErrorHandler" );


    Of course you have to modify this to your own xml if you dont want to user the Blueprint class. For other error such as this:
    QUOTE
    Terjadi kesalahan!
    Terjadi kesalahan saat memproses permintaan terakhir Anda!
    Kami mengalami masalah saat memroses permintaan terakhir Anda! Harap coba lagi nanti. (Error Code: 404)

    The last line (Error Code: 404) is actually a regular HTTP Status:
    HTTP Status codes
    0
  • QUOTE (Natali @ Apr 20 2009, 09:38 PM) <{POST_SNAPBACK}>
    If you use the Blueprint.php class, there's this function that helps you identify which line of code that causes an error (in PHP):
    set_error_handler( "blueprintErrorHandler" );[/code]


    the important line shown by Natali is this:
    set_error_handler( "blueprintErrorHandler" );

    so, write your (uday) own error handler function. anything but fatal error then can be gracefully handled by that function which its only job is to emit error message wrapped in valid BP xml, eg. <page><content><?php echo $erro ?></content></page>.

    cmmiw, hth.
    0
This forum is locked.

Recent Posts

in Blueprint Enhancements