summaryrefslogtreecommitdiff
path: root/app/controllers/api/v1/errors_controller.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-11-10 21:55:30 -0700
committermo khan <mo@mokhan.ca>2014-11-10 21:55:30 -0700
commit3f5f93e48b0ce4ef49175d363d866cf2cb66b9a1 (patch)
tree50b0ee169b05a5327958861d076cffc0031f7223 /app/controllers/api/v1/errors_controller.rb
parent9c93c8413804ee031cf3e5d69bd43d12074c1663 (diff)
add api endpoint for recording failures.
Diffstat (limited to 'app/controllers/api/v1/errors_controller.rb')
-rw-r--r--app/controllers/api/v1/errors_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/api/v1/errors_controller.rb b/app/controllers/api/v1/errors_controller.rb
new file mode 100644
index 0000000..b093a1f
--- /dev/null
+++ b/app/controllers/api/v1/errors_controller.rb
@@ -0,0 +1,18 @@
+module Api
+ module V1
+ class ErrorsController < ApiController
+ def create
+ failure = current_environment.failures.build(error_params)
+ failure.backtrace = params[:error][:backtrace]
+ failure.save!
+ render nothing: true
+ end
+
+ private
+
+ def error_params
+ params.require(:error).permit(:message, :hostname, :error_type, :backtrace)
+ end
+ end
+ end
+end