TAILIEUCHUNG - C#Your visual blueprint for building .NET applications phần 10

Khái niệm cơ bản của làm việc với ngoại lệ đúng cách có thể thực hiện xử lý các trường hợp ngoại lệ bởi sự hiểu biết những điều cơ bản của trường hợp ngoại lệ được xử lý trong dòng chảy của mã của bạn. | 15 WORKING WITH ERRORS Basics of Working with Exceptions You can properly implement exception handling by understanding the basics of how exceptions are handled in the flow of your code. The basics of exception flow are the following When an exception occurs the exception is passed up the stack and each catch block is given the opportunity to handle the exception. To be caught by the same catch block of the procedure the exception must be thrown within a try block of that procedure otherwise the exception is raise up the stack to the next catch block. The order of catch statements is important. You need to place catch blocks targeted to specific exceptions before a general exception catch block or the compiler will issue an error. The proper catch block is determined by matching the type of the exception to the name of the exception specified in the catch block. If there is no specific catch block then the exception is caught by a general catch block if one exists. To aid the troubleshooting process of the current developer or any other developers that use your code you can write error information that is as detailed as possible and targeted to a developer. Also make sure that you cleanup intermediate results when throwing an exception. Your callers will assume that you threw the exception back through the stack after you resolved the error for example rolling back database changes . Exception Handling Model You can safely run code in the CLR by creating code to control executionflow Thebasic strorture of programs that handle exceptions. The runtime has an hesi bl cksof code for the C syntax are in the exception handling model that uses protected blocks of following sample try Run code that has the potential to throw exceptions catch Exception e Run code that will generically handle the caught exception finally Run cleanup code runs with or without exception occurring 275 C THROWING AN EXCEPTION You can pass error information back to a calling client with .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.