Bug 966681: improve robustness of error reporting. r=Unfocused