Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
failure_handler.h
Go to the documentation of this file.
1// Copyright 2026 The Symbian SDK Authors.
2// Licensed under the Apache License, Version 2.0.
3
4#ifndef SYMBIAN_API_SYSTEM_FAILURE_HANDLER_H_
5#define SYMBIAN_API_SYSTEM_FAILURE_HANDLER_H_
6
7#include <functional>
8#include <span>
9#include <string_view>
10
11#include <absl/base/nullability.h>
12
13#include "absl/status/status.h"
14
15namespace symbian::api::system {
16
18 std::string_view caption = "Application failure";
19 // Optional absolute device paths. The newest 16 KiB of each file is shown.
20 // Recent DebugLog messages are included automatically.
21 std::span<const std::u16string_view> log_paths;
22};
23
24using FailureHandledEntry = std::function<absl::Status()>;
25
26// Runs a top-level application entry. On a returned error, saves a report to
27// C:\private<app UID>\failure.txt and presents its status and latest logs in a
28// scrollable window with Exit and Copy buttons.
29// Presentation and persistence run independently. Closing/failing the view
30// destroys its window immediately; process exit waits for the background write.
31// Returns zero on success and one after both failure tasks finish.
33 const FailureHandlerOptions& options = {});
34
35// Saves and displays an immutable report on independent A11 workers after the
36// application's own window has closed. Exit destroys the view immediately;
37// the caller stays parked until persistence finishes, without retaining a
38// window. Neither task cancels the other. Returns the view error if any,
39// otherwise the persistence result. Native file operations run on the writer
40// thread; they never block the UI thread.
41// SDK executables also install this behavior for Abseil CHECK failures:
42// CHECK_OK(Main()) can be used at the integer entry boundary. A fatal CHECK
43// in a background app writes the report without opening a window.
44absl::Status ShowFailureReport(const absl::Status& error,
45 const FailureHandlerOptions& options = {});
46
47} // namespace symbian::api::system
48
49#endif // SYMBIAN_API_SYSTEM_FAILURE_HANDLER_H_
std::atomic< int > error
Definition midi_output.cc:43
Definition active_service.h:12
int RunWithFailureHandler(FailureHandledEntry entry, const FailureHandlerOptions &options={})
Definition failure_handler.cc:431
std::function< absl::Status()> FailureHandledEntry
Definition failure_handler.h:24
absl::Status ShowFailureReport(const absl::Status &error, const FailureHandlerOptions &options={})
Definition failure_handler.cc:422
Definition failure_handler.h:17
std::string_view caption
Definition failure_handler.h:18
std::span< const std::u16string_view > log_paths
Definition failure_handler.h:21