1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsObjCExceptions.h"
9 #import <Foundation/Foundation.h>
14 #include "nsICrashReporter.h"
16 #include "nsServiceManagerUtils.h"
20 void nsObjCExceptionLog(NSException* aException) {
21 NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]", [aException name],
24 // Attach exception info to the crash report.
25 nsCOMPtr<nsICrashReporter> crashReporter =
26 do_GetService("@mozilla.org/toolkit/crash-reporter;1");
28 crashReporter->AppendObjCExceptionInfoToAppNotes(
29 static_cast<void*>(aException));
33 NSLog(@"Stack trace:\n%@", [aException callStackSymbols]);
39 bool ShouldIgnoreObjCException(NSException* aException) {
40 // Ignore known exceptions that we've seen in crash reports, which shouldn't
41 // cause a MOZ_CRASH in Nightly.
42 if (aException.name == NSInternalInconsistencyException) {
43 if ([aException.reason containsString:@"Missing Touches."]) {
44 // Seen in bug 1694000.
51 } // namespace mozilla