开发技术:关于变量、移动以及含义(7)
文章作者 100test 发表时间 2007:03:14 13:47:11
来源 100Test.Com百考试题网
let s now address a situation in which your code has handled an error that was anticipated and likely caused by user input. simply displaying the oracle error message or, worse, allowing the exception to go unhandled, resulting in a display of the error stack, will not do. so, yes, you should "translate" the generic ora-0001 or ora-1403 information and the like into more-cuddly communications that achieve the following objectives:
next steps
read more about log errors oracle database data warehousing guide oracle database pl/sql packages and types reference
bulk collect, forall, and save exceptions |
- notify the user that an error has occurred. you surely do not want to "swallow" errors.
- the error message should explain the problem in terms the user can understand. from a security standpoint, you should not display the oracle error code or message. instead, display a message that explains in application-specific terms what has happened. this usually entails providing context-specific values, such as the name of the column that was being set to null or was involved in the duplicate index error.
- where appropriate, tell the user what to do to address the problem (if a "retry" makes sense). you might say, "change the name of the account to a value that is not currently being used in the database" or "adjust the birthday of the employee so that the employee is at least 18 years old."