wat_catcher 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module WatCatcher
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,26 @@
1
+ #Send the error to the same host that served this file (I think)
2
+ class @WatCatcher
3
+
4
+ constructor: (target=window) ->
5
+ @oldErrorHandler = target.onerror
6
+ target.onerror = @watHandler
7
+
8
+ watHandler: (msg, url, line) =>
9
+ xmlhttp = if window.XMLHttpRequest
10
+ new XMLHttpRequest()
11
+ else
12
+ new ActiveXObject("Microsoft.XMLHTTP")
13
+
14
+ params = "wat[page_url]=#{escape(window.location.toString())}"
15
+ params += "&wat[message]=#{escape(msg)}"
16
+ params += "&wat[backtrace][]=#{escape(url+":"+line)}"
17
+ params += "&wat[app_env]=#{escape(@appEnv)}"
18
+ xmlhttp.open("POST", "<%= WatCatcher.configuration.host %>/wats", true);
19
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
20
+ xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
21
+ xmlhttp.send(params);
22
+
23
+ if typeof @oldErrorHandler == 'function'
24
+ @oldErrorHandler(msg, url, line)
25
+
26
+ window.watCatcher = new WatCatcher()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wat_catcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-25 00:00:00.000000000 Z
12
+ date: 2013-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -130,7 +130,7 @@ files:
130
130
  - lib/wat_catcher/version.rb
131
131
  - spec/javascripts/support/jasmine.yml
132
132
  - spec/javascripts/wat_catcher_spec.coffee
133
- - vendor/assets/javascripts/wat_catcher.coffee
133
+ - vendor/assets/javascripts/wat_catcher.coffee.erb
134
134
  - wat_catcher.gemspec
135
135
  homepage: ''
136
136
  licenses:
@@ -1,30 +0,0 @@
1
- #Send the error to the same host that served this file (I think)
2
- class @WatCatcher
3
- appEnv: undefined
4
- appEnvsToWorryAbout: []
5
-
6
- constructor: (target=window) ->
7
- @oldErrorHandler = target.onerror
8
- target.onerror = @watHandler
9
-
10
- watHandler: (msg, url, line) =>
11
- if @appEnvsToWorryAbout.indexOf(@appEnv) >= 0
12
- xmlhttp = if window.XMLHttpRequest
13
- new XMLHttpRequest()
14
- else
15
- new ActiveXObject("Microsoft.XMLHTTP")
16
-
17
- params = "wat[page_url]=#{escape(window.location.toString())}"
18
- params += "&wat[message]=#{escape(msg)}"
19
- params += "&wat[backtrace][]=#{escape(url+":"+line)}"
20
- params += "&wat[app_env]=#{escape(@appEnv)}"
21
-
22
- xmlhttp.open("POST", "/wats", true);
23
- xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
24
- xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
25
- xmlhttp.send(params);
26
-
27
- if typeof @oldErrorHandler == 'function'
28
- @oldErrorHandler(msg, url, line)
29
-
30
- window.watCatcher = new WatCatcher()