0

Is there a command in livecode to display an error message like this? I basically want to output the line number where the error occured.

if the cDev is "dev" then -- check for development system
answer error "Error"&& lineNumber && "on cardscript" & myCardName && "in stack" && myStackName
else
answer error "Please contact support"
end if

This would make it so much easier..

Tate83
  • 274
  • 1
  • 7
  • 21

2 Answers2

2

The only thing I can recommend is that you read and experiment with the "try" and "catch" control structures. If you use the "catch" keyword, then the line number where the error occurred will be located as item 2 of the "errorString"

Craig Newman

dunbarx
  • 756
  • 5
  • 4
2

Put this handler into the stack script:

on errorDialog pErr
  put item 2 of line 1 of pErr into tLineNum
  -- do whatever you want here
end errorDialog

See "errorDialog" in LiveCode's dictionary for more information about what the numbers mean. You can retrieve the error code, line number, and hint.

Jacque
  • 416
  • 2
  • 7