ctws 0.2.2.beta → 0.2.3.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '083ac80582de8e764c98b760ea9ffb4c3b7a5aa8'
4
- data.tar.gz: ddc0b98596ebde39a03d3ecd4a65de15ada9d526
2
+ SHA256:
3
+ metadata.gz: 5af5f02fa153385302590528d21f68762a075693e5689e357852d3837dc12333
4
+ data.tar.gz: 422db50de1bef22b0748aaeb7742fa5542bc6734d89d5f058f24eb453c7a1163
5
5
  SHA512:
6
- metadata.gz: 32695b8f7a7cdcf786914fab6b50ffe3c1c897ac323c6ef9e88b7596a67126705ad411094358165d398cdff95efeb7e8ab7b8d862101a5334770e8f60ce25e04
7
- data.tar.gz: 02a035082f6809803755b25ca1649ec6d0bb6e5777dd38a108996b496f5fabdb0d0e2227c41791fc3dd385ddef1c07a7bea245f0523b5dbd0f2a037a0f9b8101
6
+ metadata.gz: 102b91e2b6ed522f794f46d1b8ad6d6c936a2a87fad44df579b31b7155528095386287eee3d7fdb1e5c145a8d0b804fd0a0d5ab7e1d36191734aba5f9b314767
7
+ data.tar.gz: fd55fccf6a9ee52c08798a6defe6b4d17467a64f80d2ee0abd3afa3238f1725aab72a112266ac6c634b696dd6843a4dbf67f4bf33818959e3ccd31a452232471
@@ -40,26 +40,34 @@ module Ctws
40
40
 
41
41
  # JSON response with message; Status code 401 - Unauthorized
42
42
  def unauthorized_request(e)
43
- json_response([{ message: e.message, error_code: 401}], :unauthorized)
43
+ json_response(error_response_params(e, 401), :unauthorized)
44
44
  end
45
45
 
46
46
  # JSON response with message; Status code 404 - Not Found
47
47
  def not_found(e)
48
- json_response([{ message: e.message, error_code: 404 }], :not_found)
48
+ json_response(error_response_params(e, 404), :not_found)
49
49
  end
50
50
 
51
51
  def not_confirmed(e)
52
- json_response([{ message: e.message, error_code: 403 }], :unauthorized)
52
+ json_response(error_response_params(e, 403), :unauthorized)
53
53
  end
54
54
 
55
55
  # JSON response with message; Status code 422 - unprocessable entity
56
56
  def four_twenty_two(e)
57
- json_response([{ message: e.message, error_code: 422 }], :unprocessable_entity)
57
+ json_response(error_response_params(e, 422), :unprocessable_entity)
58
58
  end
59
59
 
60
60
  # JSON response with message; Status code 498 - Invalid Token
61
61
  def four_ninety_eight(e)
62
- json_response([{ message: e.message, error_code: 498 }], :invalid_token)
62
+ json_response(error_response_params(e, 498), :invalid_token)
63
+ end
64
+
65
+ #------------------------------------------------------
66
+ private
67
+ #------------------------------------------------------
68
+
69
+ def error_response_params(exception, error_code)
70
+ [{ message: exception.message, error_code: error_code, data: exception.backtrace}]
63
71
  end
64
72
 
65
73
  end
data/lib/ctws/version.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  module Ctws
2
2
  # Under development: BETA
3
3
 
4
- VERSION = '0.2.2.beta'
4
+ VERSION = '0.2.3.beta'
5
+
6
+ # PATCH - 0.2.3.beta - 31/11/2018
7
+ # [REFACTOR] Add exception backtrace to error responses.
5
8
 
6
9
  # PATCH - 0.2.2.beta - 14/5/2018
7
10
  # [ADDED] Add fr locale.