Trouble submitting errors using Airbrake.notify({})

Daniel Heath's Avatar

Daniel Heath

03 Feb, 2012 04:21 AM via web

I'm calling:

  Airbrake.notify
    params:
      message: "Error saving record"
      json: JSON.stringify(model)
    message: 'Save Error in Christo'

which is sending the following data across the wire:

<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"><api-key>bd88b60a2fd63f921372b7daa3b24b49</api-key><notifier><name>airbrake_js</name><version>0.1.0</version><url>http://airbrake.io</url></notifier><error><class>Error</class><message>Save Error in Christo</message><backtrace><line method="{anonymous}([object Object],[object Object])" file="[PROJECT_ROOT]/assets/discover_main.js" number="8160" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/discover_main.js" number="8369" /><line method="{anonymous}([object Object],(function (n, o, p) {i(n, o);return m._store(o);}),(function () {return e(h, l);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8403" /><line method="{anonymous}([object Object],&#34;error&#34;,&#34;&#34;)" file="[PROJECT_ROOT]/assets/discover_main.js" number="8369" /><line method="{anonymous}([object Object],[object Array])" file="[PROJECT_ROOT]/assets/common.js" number="324" /><line method="w(422,&#34;error&#34;,[object Object],&#34;Connection: close\nDate: Thu, 02 Feb 2012 04:57:52 GMT\nContent-Type: application/xml; charset=utf-8\nX-Runtime: 332\nContent-Length: 2054\nCache-Control: no-cache\n&#34;)" file="[PROJECT_ROOT]/assets/common.js" number="1431" /><line method="{anonymous}()" file="[PROJECT_ROOT]/assets/common.js" number="1514" /><line method="{anonymous}([object Object],w)" file="[PROJECT_ROOT]/assets/common.js" number="1515" /><line method="{anonymous}((void 0))" file="[PROJECT_ROOT]/assets/common.js" number="1466" /><line method="{anonymous}(&#34;update&#34;,[object Object],[object Object])" file="[PROJECT_ROOT]/assets/discover_main.js" number="8379" /><line method="{anonymous}([object Object],(function (n, o, p) {i(n, o);return m._store(o);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8373" /><line method="{anonymous}([object Object],0,[object Array])" file="[PROJECT_ROOT]/assets/discover_main.js" number="8358" /><line method="{anonymous}([object Array],(function (m) {return j.send(m, g, e);}))" file="[PROJECT_ROOT]/assets/common.js" number="1684" /><line method="{anonymous}((function (m) {return j.send(m, g, e);}))" file="[PROJECT_ROOT]/assets/common.js" number="2303" /><line method="{anonymous}([object Object],(function (l, n, j) {var m;return (m = i.shift()) != null ? m.saveMultiple(g, h, l, n, j) : void 0;}),(function (n, o, p) {i(n, o);return m._store(o);}),(function () {return console.log(&#34;finished saving all pois&#34;);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8358" /><line method="{anonymous}((function (n, o, p) {i(n, o);return m._store(o);}),(function () {return console.log(&#34;finished saving all pois&#34;);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8167" /><line method="{anonymous}([object Object],(function (l, n, j) {var m;return (m = i.shift()) != null ? m.saveMultiple(g, h, l, n, j) : void 0;}),(function (n, o, p) {i(n, o, p);return m.findOrStore(n);}),(function () {return console.log(&#34;finished saving all pois&#34;);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8437" /><line method="{anonymous}((function (n, o, p) {i(n, o, p);return m.findOrStore(n);}),(function () {return console.log(&#34;finished saving all pois&#34;);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8167" /><line method="{anonymous}([object Object],(function (l, n, j) {var m;return (m = i.shift()) != null ? m.saveMultiple(g, h, l, n, j) : void 0;}),(function (j, l) {return j.trigger(&#34;save:success&#34;, l);}),(function () {return console.log(&#34;finished saving all pois&#34;);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8514" /><line method="{anonymous}((function (j, l) {return j.trigger(&#34;save:success&#34;, l);}),(function () {return console.log(&#34;finished saving all pois&#34;);}),(function (l, j) {console.log({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});Airbrake.notify({params: {message: &#34;Error saving record&#34;, json: JSON.stringify(l)}, message: &#34;Save Error in Christo&#34;});l.trigger(&#34;save:error&#34;, j);return c.apply(null, arguments);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8167" /><line method="{anonymous}([object Object],(function () {return console.log(&#34;finished saving all pois&#34;);}),(function () {return console.log(&#34;error saving all pois&#34;);}))" file="[PROJECT_ROOT]/assets/discover_main.js" number="8169" /><line method="{anonymous}()" file="[PROJECT_ROOT]/assets/discover_main.js" number="8925" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/discover_main.js" number="13500" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/discover_main.js" number="13314" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/common.js" number="646" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/common.js" number="588" /><line method="{anonymous}([object Object],[object Array],[object HTMLDocument])" file="[PROJECT_ROOT]/assets/common.js" number="633" /><line method="{anonymous}(0,[object HTMLDocument])" file="[PROJECT_ROOT]/assets/common.js" number="739" /><line method="{anonymous}([object Object],(function () {f.event.trigger(a, b, this);}),(void 0))" file="[PROJECT_ROOT]/assets/common.js" number="252" /><line method="{anonymous}((function () {f.event.trigger(a, b, this);}))" file="[PROJECT_ROOT]/assets/common.js" number="189" /><line method="{anonymous}(&#34;save_and_send_content&#34;,(void 0))" file="[PROJECT_ROOT]/assets/common.js" number="739" /><line method="{anonymous}(&#34;save_and_send_content&#34;)" file="[PROJECT_ROOT]/assets/discover_main.js" number="5866" /><line method="{anonymous}()" file="[PROJECT_ROOT]/assets/discover_main.js" number="6513" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/discover_main.js" number="6382" /><line method="M([object Object])" file="[PROJECT_ROOT]/assets/common.js" number="139" /><line method="{anonymous}([object Object])" file="[PROJECT_ROOT]/assets/common.js" number="646" /><line method="{anonymous}([object MouseEvent])" file="[PROJECT_ROOT]/assets/common.js" number="588" /></backtrace></error><request><url>http://0.0.0.0:3000/discover/Cales de Mallorca &#38; Around/1318588#edit</url><component>discover</component><action>index</action><cgi-data><var key="HTTP_USER_AGENT">Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1</var></cgi-data><params><var key="message">Error saving record</var><var key="json">{&#34;poi&#34;:{&#34;@about&#34;:&#34;/pois/1164781/lang/en&#34;,&#34;id&#34;:&#34;1164781&#34;,&#34;ethyl_id&#34;:null,&#34;feature_id&#34;:null,&#34;place&#34;:{&#34;@about&#34;:&#34;/places/1318588&#34;,&#34;@about_children&#34;:&#34;/places/1318588/children&#34;,&#34;@about_pois&#34;:&#34;/places/1318588/pois&#34;,&#34;id&#34;:1318588,&#34;name&#34;:&#34;Cales de Mallorca &#38; Around&#34;,&#34;ethyl_id&#34;:null,&#34;full_name&#34;:&#34;Europe -&#62; Spain -&#62; Mallorca, Menorca &#38; Ibiza -&#62; Mallorca -&#62; Eastern Mallorca -&#62; Cala Millor to Portocolom -&#62; Cales de Mallorca &#38; Around&#34;},&#34;type&#34;:&#34;Sleep&#34;,&#34;latitude&#34;:null,&#34;longitude&#34;:null,&#34;published&#34;:true,&#34;name&#34;:&#34;S&#39;Aigo&#34;,&#34;searchable_name&#34;:&#34;s&#39;aigo&#34;,&#34;alt_name&#34;:&#34;&#34;,&#34;subtype&#34;:&#34;Rural Hotel&#34;,&#34;telephones&#34;:[{&#34;area_code&#34;:null,&#34;number&#34;:&#34;971 833 050&#34;,&#34;text&#34;:null}],&#34;emails&#34;:[],&#34;urls&#34;:[&#34;www.fincasaigo.com&#34;],&#34;properties&#34;:[{&#34;key&#34;:&#34;attributes&#34;,&#34;value&#34;:&#34;nonsmoking&#34;},{&#34;key&#34;:&#34;attributes&#34;,&#34;value&#34;:&#34;parking&#34;},{&#34;key&#34;:&#34;attributes&#34;,&#34;value&#34;:&#34;swimmingpool&#34;},{&#34;key&#34;:&#34;authorStatus&#34;,&#34;value&#34;:&#34;EditorReady&#34;},{&#34;key&#34;:&#34;cuisine&#34;,&#34;value&#34;:null},{&#34;key&#34;:&#34;prototype&#34;,&#34;value&#34;:null}],&#34;review&#34;:{&#34;summary&#34;:&#34;&#60;p&#62;Just 3km from Cala &#60;em&#62;&#60;strong&#62;Murada&#60;/strong&#62;&#60;/em&#62; sits serene S&#39;Aigo, an ivy-smothered rural estate whose two self-catering stone houses sleep 12 people each. Ideal for groups and families, the rustic stone houses are set amid the shady Mallorcan countryside. Most of the houses have barbecues outside, and some even have a piano.&#60;/p&#62;&#34;,&#34;detail&#34;:&#34;&#34;},&#34;hours&#34;:&#34;&#34;,&#34;price_string&#34;:&#34;r €210-395&#34;,&#34;price_range&#34;:null,&#34;address&#34;:{&#34;street&#34;:&#34;Carretera Portocolom-Portocristo Km2.4&#34;,&#34;locality&#34;:&#34;S&#39;Espinagar&#34;,&#34;postcode&#34;:&#34;07689&#34;,&#34;extras&#34;:null,&#34;region&#34;:&#34;Eastern Mallorca&#34;,&#34;neighbourhood&#34;:null},&#34;transports&#34;:[],&#34;verified_on&#34;:&#34;2011-05-11&#34;,&#34;notes&#34;:&#34;&#34;}}</var></params></request><server-environment><project-root>http://0.0.0.0:3000</project-root><environment-name>local_development</environment-name></server-environment></notice>

but in response I get

<html><body><h1>400 Bad request</h1>
Your browser sent an invalid request.
</body></html>

when I was expecting a new error to be created.

The XML I am sending is valid according to http://airbrake.io/airbrake_2_2.xsd

What am I missing?

  1. Support Staff 2 Posted by Stuart Chaney on 04 Feb, 2012 11:06 PM

    Stuart Chaney's Avatar

    Hey Daniel,

    Are you using the airbrake ruby notifier?

    If so does this work for you?

    begin
    params = {

    # params that you pass to a method that can throw an exception
    

    } my_unpredicable_method(params) rescue => e
    Airbrake.notify(

    :error_class   => "Special Error",
    :error_message => "Special Error: #{e.message}",
    :parameters    => params
    

    ) end

    Cheers

    Stuart

  2. 3 Posted by Daniel Heath on 05 Feb, 2012 05:44 AM

    Daniel Heath's Avatar

    No, I'm using the javascript notifier (via coffeescript).

    The problem is that airbrake is sometimes failing to record a special error, but I can't figure out why.

  3. Support Staff 4 Posted by airbrakeben on 08 Feb, 2012 05:55 PM

    airbrakeben's Avatar

    Hi Daniel,
    We're currently focused on an urgent site issue, if you feel that this is urgent and it needs attention immediately please reply to this ticket, or call (888) 479 8323.

    On a side note, we're going to be updating our javascript notifier in the coming months.

  4. 5 Posted by Daniel Heath on 08 Feb, 2012 10:23 PM

    Daniel Heath's Avatar

    I'm concerned that there may be a whole class of errors happening to my users which I have no way to find out about (since they are getting rejected by Airbrake).

    Is there any way to find out how many API requests have failed for a specific API key?

  5. Support Staff 6 Posted by airbrakeben on 15 Feb, 2012 05:21 PM

    airbrakeben's Avatar

    At this time there isn't a way how many API requests have failed for a specific API key. We've had a few requests to build a more robust developer toolset; and we hope that we can provide these in the future.

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.