Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created November 18, 2015 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domcleal/51f8640b4072ee38cda0 to your computer and use it in GitHub Desktop.
Save domcleal/51f8640b4072ee38cda0 to your computer and use it in GitHub Desktop.
diff --git a/app/controllers/api/v2/hosts_controller.rb b/app/controllers/api/v2/hosts_controller.rb
index 9e69f29..c2443f8 100644
--- a/app/controllers/api/v2/hosts_controller.rb
+++ b/app/controllers/api/v2/hosts_controller.rb
@@ -87,7 +87,10 @@ module Api
merge_interfaces(@host)
forward_request_url
- process_response @host.save
+ r = @host.save
+ log_resource_errors(@host)
+ @host.interfaces.map { |i| log_resource_errors(i) }
+ process_response r
rescue InterfaceTypeMapper::UnknownTypeExeption => e
render_error :custom_error, :status => :unprocessable_entity, :locals => { :message => e.to_s }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment