# Examples: Run-time errors

- This validation formula for the Price field causes a save operation for the document to fail with the specified message if the Price field contains an error.
`@If(@IsError(Price); @Failure("The Price field must be numeric"); @Success)`

- This example contains input translation and input validation formulas. The input translation formula puts an error into the Price field if its value is greater than 14.99. The input validation formula causes a save operation for the document to fail with the specified message if the Price field contains an error.
`REM "Input translation formula for Price field"; @If(Price > 14.99; @ERROR; Price) REM "Input validation formula for Price field"; @If(@IsError(Price); @Failure("The Price field must be numeric and 14.99 or less"); @Success)`

- This button formula checks the Price field for an error before applying a discount. If the field contains an error, the formula returns first giving the user a message.
`FIELD Price := @If(!@IsError(Price) & @IsNumber(Price) & Price < 15; Price * 0.85; @Return(@Prompt([Ok]; "Error in price field"; "Must be numeric and less than 15.00"; ""))); @All`

- This button formula tests the Price field for an error. If the field contains an error, the formula resets it to a value taken from the user by @Prompt.
`FIELD Price := @If(!@IsError(Price) & @IsNumber(Price) & Price < 15; Price; @TextToNumber(@Prompt([OkCancelEdit]; "Error in price field"; "Enter a number under $15.00"; ""))); @All`

- This agent formula tests the return value of an @DbLookup statement for an error. If the statement causes an error, the formula returns the text "Not available."
`result := @DbLookup("";"Snapper":"names.nsf";"People"; @Right(Name;" ") + " , " + @Left(Name; " "); "OfficePhoneNumber"); FIELD Phone := @If(@IsError(result);"Not available";result)`