Bug 1944416: Restore individual tabs from closed groups in closed windows r=dao,sessi...
[gecko.git] / browser / app / winlauncher / ErrorHandler.h
blob71fe72cf07f105f6290b585c7377dfdc53a706d0
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 https://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ErrorHandler_h
8 #define mozilla_ErrorHandler_h
10 #include "mozilla/Assertions.h"
11 #include "mozilla/WinHeaderOnlyUtils.h"
13 namespace mozilla {
15 /**
16 * All launcher process error handling should live in the implementation of
17 * this function.
19 void HandleLauncherError(const LauncherError& aError,
20 const char* aProcessType = nullptr);
22 // This function is simply a convenience overload that automatically unwraps
23 // the LauncherError from the provided LauncherResult and then forwards it to
24 // the main implementation.
25 template <typename T>
26 inline void HandleLauncherError(const LauncherResult<T>& aResult,
27 const char* aProcessType = nullptr) {
28 MOZ_ASSERT(aResult.isErr());
29 if (aResult.isOk()) {
30 return;
33 HandleLauncherError(aResult.inspectErr(), aProcessType);
36 // This function is simply a convenience overload that unwraps the provided
37 // GenericErrorResult<LauncherError> and forwards it to the main implementation.
38 inline void HandleLauncherError(
39 const GenericErrorResult<LauncherError>& aResult,
40 const char* aProcessType = nullptr) {
41 LauncherVoidResult r(aResult);
42 HandleLauncherError(r, aProcessType);
45 // Forward declaration
46 struct StaticXREAppData;
48 void SetLauncherErrorAppData(const StaticXREAppData& aAppData);
50 void SetLauncherErrorForceEventLog();
52 } // namespace mozilla
54 #endif // mozilla_ErrorHandler_h