-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'client_javascript_error_logging'
Former-commit-id: ed2f579e4dcaf7f97ce66f60dd0ee4c0ecc3eb44 [formerly 7c82537bafed8544cd482ced535df0d6df79f23a] [formerly 45cc26a837babb74582666cdbdf5ae0bd278897c [formerly c806727d4393ea59401da2413f42eb9131203387]] [formerly 82387bfcc3f5c12717f2777694d77a7095f99c08 [formerly 77d0ef590a0182a79072383b5367147992c61b3f] [formerly b63b0b45b5174ac25362fcb54668bcb5a4798ebd [formerly b63b0b45b5174ac25362fcb54668bcb5a4798ebd [formerly 092fa087182201ef13a9b03c3da3933f2f506808]]]] Former-commit-id: 54de29383976257b1260841958aded1216b4a3b6 [formerly 01ea2af5bd0d6a7474f43afa80d8a1ff224da4c2] [formerly f9a0346a1942e4490e31a7ed989d5f2df80a2ece [formerly 3101f0c7581a2dbbfdcc3dac2389f7f55fedb1d6]] Former-commit-id: 3c187f27f92025d0a4bc7377a41c1bd11f5b9a38 [formerly 23d73e80518f7ee6a49c8c9c4123afd49375c5ac] Former-commit-id: e6572a7f8f5f19260b9acecbf850624c05779256 Former-commit-id: 9bfb50f
- Loading branch information
Showing
19 changed files
with
358 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@ConsiderIt.module "Entities", (Entities, App, Backbone, Marionette, $, _) -> | ||
|
||
class Entities.Error extends App.Entities.Model | ||
name: 'error' | ||
|
||
url : () -> | ||
Routes.report_client_error_path( ) | ||
|
||
parse : (attrs) -> | ||
if 'client_error' of attrs | ||
attrs.client_error | ||
else | ||
attrs | ||
|
||
class Entities.Errors extends App.Entities.Collection | ||
model: Entities.Error | ||
|
||
parse : (attrs) -> | ||
errors = (attr.client_error for attr in attrs) | ||
errors | ||
|
||
API = | ||
all_errors : new Entities.Errors() | ||
|
||
createError : (type, trace, msg, url, line, options = {wait : true}) -> | ||
attrs = | ||
error_type : type | ||
trace : trace | ||
line : line | ||
location : url #window.location.href | ||
message : msg | ||
|
||
@all_errors.create attrs, options | ||
|
||
addErrors : (errors) -> | ||
@all_errors.add @all_errors.parse(errors), {merge: true} | ||
|
||
getErrors : -> @all_errors | ||
|
||
App.vent.on 'javascript:error', (type, trace, msg, url, line) -> | ||
API.createError type, trace, msg, url, line | ||
|
||
App.reqres.setHandler 'javascript:errors:get', -> | ||
API.getErrors() | ||
|
||
App.vent.on 'javascript:errors:fetched', (errors) -> | ||
API.addErrors errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class Dashboard::ClientErrorsController < Dashboard::DashboardController | ||
respond_to :json | ||
|
||
def index | ||
authorize! :show, ClientError | ||
|
||
rendered_admin_template = params["admin_template_needed"] == 'true' ? self.process_admin_template() : nil | ||
|
||
errors = ClientError.all.limit(500) | ||
|
||
render :json => {:account => current_tenant, :admin_template => rendered_admin_template, :errors => errors} | ||
end | ||
|
||
def create | ||
authorize! :create, ClientError | ||
|
||
error_params = params['error'] | ||
|
||
ua = UserAgent.parse(request.user_agent) | ||
more_params = { | ||
:session_id => request.session_options[:id], | ||
:ip => request.remote_ip, | ||
:user_agent => request.user_agent, | ||
:browser => ua.browser, | ||
:version => ua.version.to_s, | ||
:platform => ua.platform, | ||
:user_id => current_user ? current_user.id : nil | ||
} | ||
|
||
error_params.update more_params | ||
|
||
error = ClientError.create! error_params.permit(:error_type, :trace, :line, :message, :user_id, :session_id, :user_agent, :location, :ip, :browser, :version, :platform) | ||
|
||
respond_to do |format| | ||
format.json {render :json => error} | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class ClientError < ActiveRecord::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.