Зарегистрироваться
Восстановить пароль
FAQ по входу

Grimm Avdi. Exceptional Ruby

  • Файл формата pdf
  • размером 410,71 КБ
  • Добавлен пользователем
  • Описание отредактировано
Grimm Avdi. Exceptional Ruby
Electronic book (not issued yet) - 2011 - 102 pages
About
- History
Acknowledgements
What is a failure?
- Definitions
- Failure as a breach of contract
- Reasons for failure
The life-cycle of an exception
- It all starts with a raise (or a fail)
- Calling raise
- Overriding raise for fun and profit
- A simple raise replacement
- What’s the time? Hammertime!
- raise internals
- Step 1: Call #exception to get the exception
- Implementing your own #exception methods
- Step 2: #set_backtrace
- Step 3: Set the global exception variable
- Step 4: Raise the exception up the call stack
- ensure
- ensure with explicit return
- Coming to the rescue
- Dynamic rescue clauses
- rescue as a statement modifier
- If at first you don’t succeed, retry, retry again
- raise during exception handling
- Nested exceptions
- More ways to re-raise
- Disallowing double-raise
- else
- Uncaught exceptions
- Exceptions in threads
- Are Ruby exceptions slow?
Responding to failures
- Failure flags and benign values
- Reporting failure to the console
- Warnings as errors
- Remote failure reporting
- A true story of cascading failures
- Bulkheads
- The Circuit Breaker pattern
- Ending the program
Alternatives to exceptions
- Sideband data
- Multiple return values
- Output parameters
- Caller-supplied fallback strategy
- Global variables
- Process reification
- Beyond exceptions
Your failure handling strategy
- Exceptions shouldn’t be expected
- A rule of thumb for raising
- Use throw for expected cases
- What constitutes an exceptional case?
- Caller-supplied fallback strategy
- Some questions before raising
- #1: Is the situation truly unexpected?
- #2: Am I prepared to end the program?
- #3: Can I punt the decision up the call chain?
- #4: Am I throwing away valuable diagnostics?
- #5: Would continuing result in a less informative exception?
- Isolate exception handling code
- Isolating exception policy with a Contingency Method
- Exception Safety
- The three guarantees
- When can exceptions be raised?
- Exception safety testing
- Implementation of the exception-safety tester
- Validity vs. consistency
- Be specific when eating exceptions
- Namespace your own exceptions
- Tagging exceptions with modules
- The no-raise library API
- Three essential exception classes
- Failures: the user’s perspective
- Three classes of exception
Appendix A: Exception tester implementation
Appendix B: An incomplete tour of ruby’s standard exceptions
- NoMemoryError
- ScriptError
- SignalException
- StandardError
- RuntimeError
- IOError
- ArgumentError, RangeError, TypeError, IndexError
- SystemCallError
- SecurityError
- Timeout::Error
  • Чтобы скачать этот файл зарегистрируйтесь и/или войдите на сайт используя форму сверху.
  • Регистрация