Topic Path: Symbol Reference > Classes > EIdException Class > EIdException Methods > IfFalse Method
EIdException.IfFalse Method

Raises an instance of the exception based on an expression value.

class procedure IfFalse(
    const ACheck: Boolean; 
    const AMsg: string = ''
Condition to check for a False value.
Exception message text to assign to the exception instance. 

IfFalse is a class procedure used to raise an instance of the exception class when the condition in ACheck returns a False value. As a class method, IfFalse can be called without creating a prior instance of the exception class. 

When the condition in ACheck contains False, IfFalse calls Toss with the value in AMsg to raise the exception class instance. 

Use IfTrue to raise an instance of the exception class when the condition in ACheck contains True.

Using class methods in an Indy Exception descendant.

  EIdException.IfNotAssigned(AnObject, 'Object has not been created.');

  EIdException.IfAssigned(AnObject.Data, 'Object already has data.');

    'Object connection has closed before completion.');

    'Object connection is not open.');

  EIdException.IfNotInRange(AnObject.Port, 30000, 39999,
    'Object port number is invalid for this protocol.');

  // no exception raised... continue processing.
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.