Differents between error and exception in C#

本文探讨了ASP.NET中常见的错误类型,包括配置错误、编译错误和解析错误,并详细解释了运行时异常的原因及如何通过异常处理代码来避免应用程序崩溃,确保用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

An error is a mistake is coding on the part of the programmer, so the program won't give the desired result.

For exampile, in ASP.NET there are different types of error:

1. Configuration error: these error arise when the web.config or machine.config files are not formed properly.

2. Compilation error: raised during compilation due to mistakes in language syntax

3. Parser errors: caused by incorrect tays and other syntax error in the ASP.NET page.

An exception is a run-time error that may occur due to wrong input type or other circumstance. for example:

divide by zero, worng format, file not found, file used in another application, array out bonds, over flow, DBNULL cannot convert to int string etc.

Errors are not handled they have to fixed by the programmer.

Exceptions should be handled using exception handling code(try catch throw block) so that the application won't crash. and inform user that exception has occured. can show the description of the exception, the exception arised in which function and which line etc.

转载于:https://www.cnblogs.com/Jenny90/archive/2013/03/19/2968872.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值