DEV Community

Discussion on: Smarter Rails Services with Active Model Modules

 
sophiedebenedetto profile image
Sophie DeBenedetto

Ah okay I see what you're saying. I think you can choose how to raise and handle exceptions as you would in any Rails model or service without violating the basic design outlined here. You have a few options available to you--use additional custom validators to add errors to the PurchaseHandler instance, or raise custom errors. I wrote another post on a pattern of custom error handling in similar service objects within a Rails API on my personal blog if you want to check it out: thegreatcodeadventure.com/rails-ap...

Thread Thread
 
ipmsteven profile image
Yunlei Liu

Thanks!