[bug 882558] Corrected error handling

Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=882558