Perl Best Practices [Electronic resources] نسخه متنی
لطفا منتظر باشید ...
B.12. Chapter 13, Error Handling
- Throw exceptions instead of returning special values or setting flags. [Exceptions ]
- Make failed builtins throw exceptions too. [Builtin Failures ]
- Make failures fatal in all contexts. [Contextual Failure ]
- Be careful when testing for failure of the system builtin. [Systemic Failure ]
- Throw exceptions on all failures, including recoverable ones. [Recoverable Failure ]
- Have exceptions report from the caller's location, not from the place where they were thrown. [Reporting Failure ]
- Compose error messages in the recipient's dialect. [Error Messages ]
- Document every error message in the recipient's dialect. [Documenting Errors ]
- Use exception objects whenever failure data needs to be conveyed to a handler. [OO Exceptions ]
- Use exception objects when error messages may change. [Volatile Error Messages ]
- Use exception objects when two or more exceptions are related. [Exception Hierarchies ]
- Catch exception objects in most-derived-first order. [Processing Exceptions ]
- Build exception classes automatically. [Exception Classes ]
- Unpack the exception variable in extended exception handlers. [Unpacking Exceptions ]