Page Blocks

Hosting sponsored by:

Point In Space

 

API: Err

Filename:
fwpErr_removeCode.ctag

Released With:
5.0.0

Current Version:
1.1.0

Status: Active

Min Lasso Tested: 8.1.0

Max Lasso Tested: 8.5.3

Related:

Still don't get it?

Check out the talk list archives, or join and ask your questions.

Documentation Error or Request?

Email documentation corrections or comments

API Reference

fwpErr_removeCode (Tag)

Description

Use this tag to remove an error code from $fw_error.

There are occasions where the application may not want to alert the user to a certain error condition, or it may want to inject it's own error code to have a different message displayed.

For example, you have done a search for news articles, and none were found. Instead of getting the generic No Records Found error message, you might want the message to say No News Articles Found. You wouldn't just override the default error message in the strings file, because you might also need a message of No Calendar Events Found For Today.

So, to do this, you test for a 5100 error code (the one for no records found) after performing a ->select, remove it, and inject your own error code in its place.

Examples

$newsArticles->(select:....);

if: $fw_error >> '5100');
   $fw_error->(removeCode:'5100');
   $fw_error->(insert:'5610'='no news rcrds');
/if;

Source Code

View in separate window

<?lassoscript
//............................................................................
//
//    pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*

    {fileName=        fwpErr_removeCode.ctag }
    {rsrcType=        tag }
    {rsrcName=        fwpErr_removeCode }
    {rsrcHTTP=        www.pageblocks.org/refc/fwpErr_removeCode }

    {lassoVrsnMin=    8.1.0 }
    {lassoVrsnMax=    8.5.3 }

    {author=        Greg Willits }
    {authorEmail=    subscribe to pbTalk at www.pageblocks.org/talk/ }
    {authorHTTP=    www.pageblocks.org }

    {desc=            This file removes all occurrences of the specified error
                    code from the fw_error array. }

    {maintvsrn=        1.1.0 }
    {maintrelease=    5.1.0 }
    {maintdate=        2006-05-30}
    {maintauthor=    Greg Willits }
    {maintnotes=    added tagTrace }

    {maintvsrn=        1.0 }
    {maintrelease=    5.0.0 }
    {maintdate=        2006-01-16 }
    {maintauthor=    Greg Willits }
    {maintnotes=    initial release }

*/
//.............................................................................

define_tag:'fwpErr_removeCode', -priority='replace',
    -required = 'code';

    $fw_debug ? $fw_tagTracer->(add:'fwpErr_removeCode');

    iterate: $fw_error->(findindex:#code), local:'thisError';
        $fw_error->(remove:#thisError);
    /iterate;

/define_tag;
?>

© 2002-2010, pageblocks.org