forked from mirrors/gecko-dev
This patch does a couple of things: * I added a new class, |WindowsError| to WinHeaderOnlyUtils. The idea here is to encapsulate as much of the Windows error gamut as possible into one class. Since Win32 errors and NTSTATUS codes may both be encoded as HRESULTs, I used the latter type to store the error. It also contains functions for converting between the various error code formats, as well as stringification via FormatMessage. * I added |LauncherError| which also includes file and line number information, which I believe will be important for launcher process failure diagnostics. (Instantiation of LauncherErrors obviously must be done via macros to capture __FILE__ and __LINE__). * I then converted all of the launcher process code (and its few depenencies) to utilize this new functionality via the new |LauncherResult| type. * If we detect an error in one of the top-level launcher process functions, we pass it to |HandleLauncherError| for processing. This function currently just throws up a |MessageBox| like the previous code did, with the intention of enhancing that further in the future. Differential Revision: https://phabricator.services.mozilla.com/D12365 --HG-- extra : moz-landing-system : lando
24 lines
734 B
C++
24 lines
734 B
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "ErrorHandler.h"
|
|
|
|
namespace mozilla {
|
|
|
|
void
|
|
HandleLauncherError(const LauncherError& aError)
|
|
{
|
|
// This is a placeholder error handler. We'll add telemetry and a fallback
|
|
// error log in future revisions.
|
|
WindowsError::UniqueString msg = aError.mError.AsString();
|
|
if (!msg) {
|
|
return;
|
|
}
|
|
|
|
::MessageBoxW(nullptr, msg.get(), L"Firefox", MB_OK | MB_ICONERROR);
|
|
}
|
|
|
|
} // namespace mozilla
|