error-handling-patterns

Implements exception handling patterns for ASP.NET Zero application services.

Updated May 22, 2026
One-click install
npx skills add https://github.com/shakesoft/timekeeper --skill error-handling-patterns-shakesoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/shakesoft/timekeeper/tree/main/.cursor/skills/error-handling-patterns
Command: npx skills add https://github.com/shakesoft/timekeeper --skill error-handling-patterns-shakesoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working on ASP.NET Zero projects often struggle to choose the right exception type and consistently localize error messages, leading to leaked internal details or unhandled business rule violations. ## Core Features & Use Cases - Exception Type Selection: Provides a decision table mapping UserFriendlyException, AbpAuthorizationException, AbpValidationException, and standard exceptions to their appropriate scenarios. - Business Rule Validation Patterns: Shows how to validate business rules in app services and throw localized UserFriendlyException messages before performing destructive operations. - Use Case: When implementing a product deletion endpoint, use this Skill to check for dependent orders and throw a localized UserFriendlyException instead of letting a raw database error reach the client. ## Quick Start Apply the error handling patterns to add a localized business rule check before deleting an entity in my ASP.NET Zero app service.

Frequently Asked Questions about error-handling-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I throw user-friendly exceptions in ASP.NET Zero?▼

Throw a UserFriendlyException with a localized message using L("Key") so the message displays directly to the user. You can pass a second localized string as details, and ABP automatically formats the response for the client.

When should I use UserFriendlyException vs standard exceptions?▼

Use UserFriendlyException for expected business rule violations where the message should reach the user. Standard exceptions are for unexpected errors; ABP logs them and shows only a generic message, never exposing internal details.

How does ABP handle authorization and validation exceptions?▼

ABP automatically handles AbpAuthorizationException and AbpValidationException, returning appropriate user-facing responses without manual try-catch blocks. Use the AbpAuthorize attribute for permission checks and let validation attributes raise validation errors.

Should error messages be hardcoded in ASP.NET Zero?▼

No, error messages should never be hardcoded. Always use the L() localization method with a resource key so messages can be translated and maintained centrally in localization files.

How do I validate business rules before deleting an entity?▼

Query related data with the repository, such as counting dependent orders, and throw a UserFriendlyException if the rule is violated before calling DeleteAsync. Place this logic in the app service method guarded by the appropriate AbpAuthorize permission.