amount: takurami.price) when :success true when :insufficient_funds raise PaymentError, "残高不足" else raise PaymentError, "不明なエラー" end rescue ActiveRecord::RecordNotFound => e raise e, '応募可能な商品が見つからないか、申し込み中に在庫がなくなりました' rescue StandardError => e takurami.stock.increment_quantity! raise e end end ※ コードはダミーです