@@ -50,7 +50,7 @@ def resolve(reference)
5050
5151 private
5252 def handle_response ( response )
53- raise ClientException . new "Server returned #{ response . code } ." , response if response . code . between? ( 400 , 599 )
53+ raise client . exception_class . new "Server returned #{ response . code } ." , response if response . code . between? ( 400 , 599 )
5454 response . resource
5555 end
5656 end
@@ -66,59 +66,59 @@ def client=(client)
6666 end
6767
6868 def read ( id , client = self . client )
69- handle_response client . read ( self , id )
69+ handle_response client . exception_class , client . read ( self , id )
7070 end
7171
7272 def read_with_summary ( id , summary , client = self . client )
73- handle_response client . read ( self , id , client . default_format , summary )
73+ handle_response client . exception_class , client . read ( self , id , client . default_format , summary )
7474 end
7575
7676 def vread ( id , version_id , client = self . client )
77- handle_response client . vread ( self , id , version_id )
77+ handle_response client . exception_class , client . vread ( self , id , version_id )
7878 end
7979
8080 def resource_history ( client = self . client )
81- handle_response client . resource_history ( self )
81+ handle_response client . exception_class , client . resource_history ( self )
8282 end
8383
8484 def resource_history_as_of ( last_update , client = self . client )
85- handle_response client . resource_history_as_of ( self , last_update )
85+ handle_response client . exception_class , client . resource_history_as_of ( self , last_update )
8686 end
8787
8888 def resource_instance_history ( id , client = self . client )
89- handle_response client . resource_instance_history ( self , id )
89+ handle_response client . exception_class , client . resource_instance_history ( self , id )
9090 end
9191
9292 def resource_instance_history_as_of ( id , last_update , client = self . client )
93- handle_response client . resource_instance_history_as_of ( self , id , last_update )
93+ handle_response client . exception_class , client . resource_instance_history_as_of ( self , id , last_update )
9494 end
9595
9696 def search ( params = { } , client = self . client )
97- handle_response client . search ( self , search : { parameters : params } )
97+ handle_response client . exception_class , client . search ( self , search : { parameters : params } )
9898 end
9999
100100 def create ( model , client = self . client )
101101 model = new ( model ) unless model . is_a? ( self )
102- handle_response client . create ( model )
102+ handle_response client . exception_class , client . create ( model )
103103 end
104104
105105 def conditional_create ( model , params , client = self . client )
106106 model = new ( model ) unless model . is_a? ( self )
107- handle_response client . conditional_create ( model , params )
107+ handle_response client . exception_class , client . conditional_create ( model , params )
108108 end
109109
110110 def partial_update ( id , patchset , options = { } )
111- handle_response client . partial_update ( self , id , patchset , options )
111+ handle_response client . exception_class , client . partial_update ( self , id , patchset , options )
112112 end
113113
114114 def all ( client = self . client )
115- handle_response client . read_feed ( self )
115+ handle_response client . exception_class , client . read_feed ( self )
116116 end
117117
118118 private
119119
120- def handle_response ( response )
121- raise ClientException . new "Server returned #{ response . code } ." , response if response . code . between? ( 400 , 599 )
120+ def handle_response ( exception_class , response )
121+ raise exception_class . new "Server returned #{ response . code } ." , response if response . code . between? ( 400 , 599 )
122122 response . resource
123123 end
124124 end
0 commit comments