teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

error_messageを追加

2020/09/03 02:18

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
@@ -30,11 +30,6 @@
30
30
  case type
31
31
  when 1 then puts "subject: card is incorrect"
32
32
  when 2 then puts "subject: Too many requests made to the API too quickly"
33
- when 3 then puts "subject: Invalid parameters were supplied to Stripe's API"
34
- when 4 then puts "subject: Authentication with Stripe's API failed"
35
- when 5 then puts "subject: Network communication with Stripe failed"
36
- when 6 then puts "subject: Display a very generic error to the user, and maybe send"
37
- when 7 then puts "subject: Something else happened, completely unrelated to Stripe"
38
33
  end
39
34
  # puts e.error # NOTE only development
40
35
  Rails.logger.debug(e)

2

error_messageを追加

2020/09/03 02:18

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
@@ -23,4 +23,20 @@
23
23
  rescue => e
24
24
  error_message(e, 7)
25
25
  end
26
+
27
+ private
28
+
29
+ def error_message(e, type)
30
+ case type
31
+ when 1 then puts "subject: card is incorrect"
32
+ when 2 then puts "subject: Too many requests made to the API too quickly"
33
+ when 3 then puts "subject: Invalid parameters were supplied to Stripe's API"
34
+ when 4 then puts "subject: Authentication with Stripe's API failed"
35
+ when 5 then puts "subject: Network communication with Stripe failed"
36
+ when 6 then puts "subject: Display a very generic error to the user, and maybe send"
37
+ when 7 then puts "subject: Something else happened, completely unrelated to Stripe"
38
+ end
39
+ # puts e.error # NOTE only development
40
+ Rails.logger.debug(e)
41
+ end
26
42
  ```

1

タグの追加

2020/09/03 02:18

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
File without changes