Fortunately, developer tools and best practices can help you capture every error and prioritize them, so you can handle the exceptions that matter and focus on building features when they don’t.
The three most common types of errors include:
These error types come in six different forms:
These six error types are actually constructor functions that throw error objects. Fortunately, you can catch these errors and fix them before they cause issues with a little error-handling code. In addition to showing users a helpful message, you can log the error for future diagnosis.
A better approach involves detecting errors across sessions using an error monitoring tool. That way, you can aggregate the data to discover the most common errors across different devices, operating systems, and browsers rather than relying on a single developer machine.
BugSnag’s most powerful feature is the Stability Score, which shows you the percentage of sessions in a release that end in a crash. With this KPI in place, you can quickly determine when to focus efforts on troubleshooting bugs versus developing new features.
Of course, there are also several best practices to remember regardless of the error monitoring solution you choose. For instance, you should always use source maps to map minified code to actual lines of code and assign version numbers to ensure you’re tracking the right problems.
BugSnag’s breadcrumbs also make it easy to access a timeline of user actions and system broadcasts leading up to an error, making it easy to reproduce the error with minimal effort.
And finally, BugSnag’s search and segmentation capabilities enable larger development teams to route errors to the correct people for follow-up. For example, you can filter errors by release (e.g., latest) and context (e.g., a shopping cart). Or, you can segment errors based on VIP users or other factors to prioritize those that matter most.