How to fail a CodedStep

2 posts, 0 answers
  1. Michel
    Michel avatar
    19 posts
    Member since:
    Jan 2011

    Posted 16 Feb 2011 Link to this post

    Hi,

    I have a CodedStep function and I would like to some conditions, the coded step return fail.

    I see that I can use ASSERT but how I do that if I have many operations to do before the function return.

    sample:
    if ( my condition here)
    {
            line code 1
            line code 2
            line code 3
            RETURN FAIL HERE.....
    }

    thanks
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 16 Feb 2011 Link to this post

    Hello Michel,
       throwing any exception will fail your coded step. In your example it will look like this:

    sample:
    if ( my condition here)
    {
            line code 1
            line code 2
            line code 3
             
    throw new Exception();
    }
    This will work with any class that extends Exception.

    Let me know if you have any other questions!

    Regards,
    Stoich
    the Telerik team
Back to Top