Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for Exclusive Open?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00741115
Message ID:
00752579
Views:
36
You're right about the necessity of the Try/Catch. I was experimenting. I would consider it generally "bad form" to use a Catch for something like this, but I wanted to give things a try.

Thanks!

>>My code looks like yours (I think), I am setting up a textlog on Database
>>Open. I get an error "TRY/CATCH/FINALLY/ENDTRY mismatch or error". What did I miss?
>>
>>
>>	PROCEDURE dbc_OpenData(cDatabaseName, lExclusive, lNoupdate, lValidate)
>>	*Immediately after DBC is opened.
>>		Public xxxDbc as Exception
>>		Try
>>			pubLogName = Alltrim(pubLogName)
>>		Catch  to xxxDbc
>>			If ( xxxDbc.ErrorNo == 12 )	&& pubLogName not set
>>			? xxxDbc.Message
>>			? xxxDbc.LineNo
>>			? xxxDbc.ErrorNo
>>			Public pubLogName = LOGNAMEPREFIX +"001.txt"
>>		Finally
>>		EndTry
>>	ENDPROC
>>
>
>Leaving aside the actual problem, which you found yourself, I don't see this as a case for using TRY/CATCH. I think it would be clearer to write:
>
>
IF EMPTY(pubLogName)
>   PUBLIC pubLogName
>   pubLogName = LOGNAMEPREFIX + "001.txt"
>ENDif
>pubLogName = ALLTRIM(pubLogName)
Previous
Reply
Map
View

Click here to load this message in the networking platform