Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Ruby on Fails - effective error handling with Rails conventions by Talysson Oliveira Cassiano You ask 10 different developers how they handle errors in their applications, you get 10 very different answers or more, that’s wild. From never raising errors to using custom errors, rescue_from, result objects, monads, we see all sorts of opinions out there. Is it possible that all of them are right? Maybe none of them? Do they take advantage of Rails conventions? In this talk, I will show you error-handling approaches based on patterns we see on typical everyday Rails applications, what their tradeoffs are, and which of them are safe defaults to use as a primary choice when defining the architecture of your application
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
The video titled "Ruby on Fails: effective error handling with Rails conventions" features Talysson Oliveira Cassiano discussing the various approaches to error handling in Ruby on Rails. In particular, Talysson emphasizes the importance of effective error management leveraging Rails conventions. The presentation is divided into three main sections: - **Introduction to Exceptions and Errors**: Talysson establishes the difference between exceptions (which indicate recoverable situations) and errors (often indicating unrecoverable states). He explains that exceptions are used to manage scenarios like validation errors and payment issues, emphasizing the role of the raise and rescue methods in Ruby. - **Common Anti-patterns**: The speaker highlights several anti-patterns in error handling that developers should avoid, including: - **Rescuing from Exception**: Talysson warns against using the generic Exception class to rescue from errors, stating it may obscure actual problems and catch undesired errors, such as syntax errors. - **Using Errors for Flow Control**: He points out that error handling should not dictate code control flow. Instead, simple conditional statements should handle expected failures, preserving clarity and performance in the codebase. - **Effective Error Handling Strategies**: Talysson argues for intentional design around error handling, including: - Establishing clear and consistent strategies to handle errors. - Creating custom error classes that describe failure conditions extensively, allowing the caller to respond appropriately. - Logging critical errors and monitoring their context, particularly in critical systems like checkout processes or fraud detection. - Utilizing application-specific error conventions to create a lightweight architecture that adheres to Rails patterns. Throughout the talk, Talysson illustrates his points with examples related to a checkout service, showing how to encapsulate functionality and manage errors without leaking unnecessary details into the calling code. He emphasizes the adoption of a centralized error reporting module, promoting a consistent way to handle and log errors across different parts of the application. Talysson concludes with several takeaways, including: - Avoid using errors for flow control, as they're meant to indicate failure. - Design for errors proactively by considering all potential unhappy paths in advance. - Centralize and structure error handling strategies while following conventions to maintain clarity and effectiveness. By implementing these practices, Rails developers can achieve more robust and maintainable codebases, improving overall application resilience.
Suggest modifications
Cancel