Skip to content

Commit

Permalink
Added hoptoad notification support
Browse files Browse the repository at this point in the history
  • Loading branch information
over committed Nov 29, 2010
1 parent 8a35259 commit 3ab3038
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 398 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
*~
*#
.idea
.DS_Store
11 changes: 9 additions & 2 deletions README
@@ -1,7 +1,14 @@
JsExceptions
============

Плагин занимается бомбардировкой электронной почты информацией об ошибках в сценариях javascript.
Плагин для отлова ошибок в JS. Может посылать ошибку как через Hoptoad, так и простым письмом.
Конфиг должен выглядеть так:

JsExceptions.configure do |c|
c.handler = :hoptoad # может быть :hopotad или :email
c.email_prefix = "[js my-super-project-name] "
c.exception_recipients = %w(my@email.com my-second-email@gmail.com)
end

Как это работает
================
Expand Down Expand Up @@ -79,7 +86,7 @@ JsExceptions

Что ещё надо знать
==================

Клиентская часть настраивается через свойства объект window.ExceptionNotifierOptions:
logErrors - отправлять ли опоовещения об ошибках на сервер
sendHtml - прикреплять ли html-содержимое страницы к отчету
Expand Down
10 changes: 3 additions & 7 deletions app/javascripts/exception_notifier.js
@@ -1,4 +1,3 @@
//= require <jquery>
(function() {
window.ExceptionNotifier = {};
$.extend(ExceptionNotifier, {
Expand Down Expand Up @@ -60,11 +59,8 @@
if ((description = document.getElementById('_error_text'))) {
error['User Description'] = description.value;
}
params.error.content = this.generateContent(error);
params.error.message = this.generateMessage(error);
this.killEvent(event);
/*window.E = error;*/
this.create(params);

this.create(error);
};
},
send: function () { },
Expand All @@ -73,7 +69,7 @@
url: "/js_exceptions",
type: "POST",
dataType: "text/html",
data: $.param(params.error)
data: $.param(params)
});
},
generateContent: function (params) {
Expand Down
19 changes: 0 additions & 19 deletions app/javascripts/jquery.js

This file was deleted.

321 changes: 0 additions & 321 deletions app/javascripts/json.js

This file was deleted.

1 change: 0 additions & 1 deletion app/javascripts/notifying_start.js
@@ -1,2 +1 @@
//= require <exception_notifier>
try {
2 changes: 1 addition & 1 deletion app/metal/js_exceptions_handler.rb
Expand Up @@ -5,7 +5,7 @@ class JsExceptionsHandler
def self.call(env)
if env["PATH_INFO"] =~ /^\/js_exceptions/
request = Rack::Request.new(env)
JsExceptions::Notifier.deliver_exception_notification request, request.params
JsExceptions.notify request, request.params
[200, {"Content-Type" => "text/html"}, ["ok"]]
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
Expand Down

0 comments on commit 3ab3038

Please sign in to comment.