2018-11-21 02:49:36 +03:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_ErrorHandler_h
|
|
|
|
#define mozilla_ErrorHandler_h
|
|
|
|
|
|
|
|
#include "mozilla/Assertions.h"
|
2019-09-07 21:17:45 +03:00
|
|
|
#include "mozilla/WinHeaderOnlyUtils.h"
|
2018-11-21 02:49:36 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All launcher process error handling should live in the implementation of
|
|
|
|
* this function.
|
|
|
|
*/
|
2020-08-26 22:01:27 +03:00
|
|
|
void HandleLauncherError(const LauncherError& aError,
|
|
|
|
const char* aProcessType = nullptr);
|
2018-11-21 02:49:36 +03:00
|
|
|
|
|
|
|
// This function is simply a convenience overload that automatically unwraps
|
|
|
|
// the LauncherError from the provided LauncherResult and then forwards it to
|
|
|
|
// the main implementation.
|
|
|
|
template <typename T>
|
2020-08-26 22:01:27 +03:00
|
|
|
inline void HandleLauncherError(const LauncherResult<T>& aResult,
|
|
|
|
const char* aProcessType = nullptr) {
|
2018-11-21 02:49:36 +03:00
|
|
|
MOZ_ASSERT(aResult.isErr());
|
|
|
|
if (aResult.isOk()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-08-26 22:01:27 +03:00
|
|
|
HandleLauncherError(aResult.inspectErr(), aProcessType);
|
2018-11-21 02:49:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// This function is simply a convenience overload that unwraps the provided
|
|
|
|
// GenericErrorResult<LauncherError> and forwards it to the main implementation.
|
|
|
|
inline void HandleLauncherError(
|
2020-08-26 22:01:27 +03:00
|
|
|
const GenericErrorResult<LauncherError>& aResult,
|
|
|
|
const char* aProcessType = nullptr) {
|
2018-11-21 02:49:36 +03:00
|
|
|
LauncherVoidResult r(aResult);
|
2020-08-26 22:01:27 +03:00
|
|
|
HandleLauncherError(r, aProcessType);
|
2018-11-21 02:49:36 +03:00
|
|
|
}
|
|
|
|
|
2019-02-26 00:14:07 +03:00
|
|
|
// Forward declaration
|
|
|
|
struct StaticXREAppData;
|
|
|
|
|
|
|
|
void SetLauncherErrorAppData(const StaticXREAppData& aAppData);
|
|
|
|
|
2019-02-26 02:11:20 +03:00
|
|
|
void SetLauncherErrorForceEventLog();
|
|
|
|
|
2018-11-21 02:49:36 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_ErrorHandler_h
|