質問編集履歴

3

error_messageを追加

2020/09/03 02:18

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
@@ -62,16 +62,6 @@
62
62
 
63
63
  when 2 then puts "subject: Too many requests made to the API too quickly"
64
64
 
65
- when 3 then puts "subject: Invalid parameters were supplied to Stripe's API"
66
-
67
- when 4 then puts "subject: Authentication with Stripe's API failed"
68
-
69
- when 5 then puts "subject: Network communication with Stripe failed"
70
-
71
- when 6 then puts "subject: Display a very generic error to the user, and maybe send"
72
-
73
- when 7 then puts "subject: Something else happened, completely unrelated to Stripe"
74
-
75
65
  end
76
66
 
77
67
  # puts e.error # NOTE only development

2

error_messageを追加

2020/09/03 02:18

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
@@ -48,4 +48,36 @@
48
48
 
49
49
  end
50
50
 
51
+
52
+
53
+ private
54
+
55
+
56
+
57
+ def error_message(e, type)
58
+
59
+ case type
60
+
61
+ when 1 then puts "subject: card is incorrect"
62
+
63
+ when 2 then puts "subject: Too many requests made to the API too quickly"
64
+
65
+ when 3 then puts "subject: Invalid parameters were supplied to Stripe's API"
66
+
67
+ when 4 then puts "subject: Authentication with Stripe's API failed"
68
+
69
+ when 5 then puts "subject: Network communication with Stripe failed"
70
+
71
+ when 6 then puts "subject: Display a very generic error to the user, and maybe send"
72
+
73
+ when 7 then puts "subject: Something else happened, completely unrelated to Stripe"
74
+
75
+ end
76
+
77
+ # puts e.error # NOTE only development
78
+
79
+ Rails.logger.debug(e)
80
+
81
+ end
82
+
51
83
  ```

1

タグの追加

2020/09/03 02:18

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
File without changes