24.06.2008, 18:05 | #1 |
Участник
|
axaptapedia: Exception handling
Источник: http://www.axaptapedia.com/Exception_handling
============== Summary: Added enums and example <div>When execution a string of code, there is a risk that something may go wrong. Exception handling lets you handle system errors by your own code. ==Try and Catch== If you are able to predict a block of code, where an exception will occur under certain circumstances, you can use the '''try''' command: try { // Block of code that may fail } catch (exception::error) { // Do something about this error } ==Retry== If you enter '''Retry''' in the '''catch''' block the '''try''' block is executes once more, but be carefull as this can result in a never-ending loop. ==Catch enums== {| border="1" |- !Enum (exception::) !Description |- |Info | |- |Warning | |- |Deadlock | |- |Error | |- |Internal | |- |Break | |- |DDEerror | |- |Sequence | |- |Numeric | |- |CLRError | |- |CodeAccessSecurity | |- |UpdateConflict | |- |UpdateConflictNotRecovered |} ==Example== static void TryCatchTest(Args _args) { Map m = new Map(types::Integer, types::String); str s; int i; ; m.insert(0,"Zero"); m.insert(1, "First"); m.insert(2, "Second"); m.insert(4, "Fourth"); for (i=0;i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|