fanforce-errors 0.2 → 0.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWNlMjUyYzI1YjRkNWVlZTk2ZjM0YzA4NjVkN2JiYmQxNTkxMDU3NA==
4
+ ZDQxZWIxNjAxOGU1MTAxZDIwZDJhM2IyZjA4YTI3NDc2YWY3MjdhMQ==
5
5
  data.tar.gz: !binary |-
6
- M2U0YzBlOTRkZWI0ODkyZjNkM2FhNGJmY2EzNDg2ZjliZmRmMjU2NQ==
6
+ NDBiMjJhZTFlMzhiMmZmYjg2ZWEyMTY2YTE3NmZiM2QwOTRhOGFjMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzEwYTI1NWQ1ZDE4NjZhODQ1NjQ5MDViYzQyNzk1NzIxNWVhNWZjNzQyNjYw
10
- N2Y5NjhmYzE0YjkxYTcwOWIwOTU4NTE1ZTExMTdkMzkwMzNjYjc3MjI3NjM1
11
- NGVjMDQwZTdkMjU0MDY2ODJmM2YyNzZmZThlZTMyYWIwYTEyYjg=
9
+ YmNhYTkwZjU1ZTNlZTI4MmY3NDM0ODYyMjllZTg0ZTRkYmUyNzM4MzU0MjI3
10
+ OTBjZWM1YmFmYmQzNzcyMzRlZmQ2NDdiMGUyNmQ0ZDAzNjhhOGQwNzhiOWJm
11
+ ZWRkYjkzYmNmYmQwMjVhYjYzMDk0NjY3YjJiMGVkNzMwNWZhMDU=
12
12
  data.tar.gz: !binary |-
13
- OWU1NTMyMjdlMGQyMzZmOGJlY2VhODA0NjM0YmE4Yjc3MDU1NTZiMWI1ZmFi
14
- MDY1NmI2ZjVkY2YzZTIyOGFhMTNmN2RmYzViYTIyYTVmMDhkNmYxMjk2MzAw
15
- Y2VjNzA3YTI2YzY2Y2RjZDViNTg2MzIyZTNmYmExMDM5NmZlNGY=
13
+ NGU4NWQ3ZjViNzgwYTIyZGQwODRjMTc3MzVlYmRmZjE1YjQ0MjQyMmNjMWRl
14
+ ZmUzZWZkYjc0MjBlZTUxNTRiZGU2NGMzYTA3ZDQ3OTJkZjE0NDZlNzI1ODE2
15
+ ODFiODEzNzc0YjQxN2FiNGI4ZDUxYjc3MzZjMDEyMzc0NzI5NTA=
@@ -14,7 +14,7 @@ class Fanforce::Error < StandardError
14
14
  end
15
15
  @public_errors = format_errors(errors)
16
16
  @env = Fanforce.env
17
- super(default_message.to_s)
17
+ super("#{@public_errors[0].to_json}")
18
18
  end
19
19
 
20
20
  def format_errors(raw_errors)
@@ -70,6 +70,16 @@ class Fanforce::Error::NotFound < Fanforce::Error # Method or record could not b
70
70
  def default_message; 'Not Found' end
71
71
  def valid_error_codes; [:record_not_found, :method_not_found] end
72
72
  def default_error_code; :unknown end
73
+ def initialize(*args)
74
+ if args[0].is_a?(Hash)
75
+ super(*args)
76
+ else
77
+ super(
78
+ resource: args[0].to_s.demodulize.singularize,
79
+ message: args[1]
80
+ )
81
+ end
82
+ end
73
83
  end
74
84
 
75
85
  class Fanforce::Error::RequestFailed < Fanforce::Error # Request has correct fields but failed for another reason
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  module Errors
3
- VERSION = '0.2'
3
+ VERSION = '0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-errors
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark