Closed Bug 878458 Opened 11 years ago Closed 11 years ago

improve error handling behavior of telemetry ping tests

Categories

(Toolkit :: Telemetry, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: froydnj, Unassigned)

Details

Attachments

(1 file)

      No description provided.
Comment on attachment 756998 [details] [diff] [review]
improve error handling behavior of telemetry ping tests

This patch fixes a few instances of bad error-handling behavior during tests: since a lot of tests are run asynchronously, there's no top-level error handling, so errors disappear into the void and the test hangs.

To remedy this, add error handling in a couple of places where it seems convenient.  This doesn't fix everything, as errors inside TelemetryPing (especially when sending XHR bits and running on* handlers defined on those requests) can still hang tests, but this is an improvement on the status quo.
Attachment #756998 - Flags: review?(vdjeric)
Comment on attachment 756998 [details] [diff] [review]
improve error handling behavior of telemetry ping tests

>+function wrapWithExceptionHandler(f) {
>+  function wrapper() {
>+    try {
>+      f.apply(null, arguments);
>+    } catch (ex if typeof(ex) == 'object') {
>+      dump("Caught exception: " + ex.message + "\n");
>+      dump(ex.stack);
>+      do_test_finished();
>+    }
>+  }
>+  return wrapper;
>+}

Why don't we catch non-object exceptions here? e.g. "throw Components.results.NS_ERROR_NOT_IMPLEMENTED"
Attachment #756998 - Flags: review?(vdjeric) → review+
(In reply to Vladan Djeric (:vladan) from comment #3)
> Comment on attachment 756998 [details] [diff] [review]
> improve error handling behavior of telemetry ping tests
> 
> >+function wrapWithExceptionHandler(f) {
> >+  function wrapper() {
> >+    try {
> >+      f.apply(null, arguments);
> >+    } catch (ex if typeof(ex) == 'object') {
> >+      dump("Caught exception: " + ex.message + "\n");
> >+      dump(ex.stack);
> >+      do_test_finished();
> >+    }
> >+  }
> >+  return wrapper;
> >+}
> 
> Why don't we catch non-object exceptions here? e.g. "throw
> Components.results.NS_ERROR_NOT_IMPLEMENTED"

Because such exceptions are thrown by the testing machinery itself when tests fail.  I didn't dig around too much in tracking this down.

http://hg.mozilla.org/integration/mozilla-inbound/rev/4d2d0bc38fec
https://hg.mozilla.org/mozilla-central/rev/4d2d0bc38fec
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: