| commit | 7118efd18fa6e20a0fa844efbf02a13c74f3626c | [log] [tgz] |
|---|---|---|
| author | Fred Shih <ffred@chromium.org> | Wed Apr 30 22:45:11 2025 |
| committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Apr 30 22:45:11 2025 |
| tree | 1a29bba2a10f3ee2466365657cb74080ef837690 | |
| parent | 0c7d4478dcb848bace18923cb987297da4b8d697 [diff] |
Add a universal mojom error type for use with result<T,E> This change adds a new universal type that can be used for most result<T,E> impls, so that API designers do not need to reimplement their own error types for their interface. It is very similar to absl::Status types, but omits the kOk state, which should never be used. Note that this currently design does not allow easy propagation of debug information. Users would have to declare their own error type if they'd like to propagate their own debug information (e.g.: HRESULT). Part of the reason this is not supported is because: 1. Mojo lack a side channel to easily stuff this additional data into. 2. The type system does not allow for easy extension of types. 3. Having a huge details struct where users have to figure out which fields to fill out can be cumbersome. Additionally, because mojo does not have any centralized error reporting, we've decided to implement a more ruidmentary error object. If this is a major issue in the future, some future work could include: 1. Adding a new native mojo type which allows users to extend the error with their own specific details struct. 2. Add a payload to the result shadow-type. Change-Id: If594a6e69fa3a094cc1a462fdced325e67728f84 Bug: 40841428 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6486488 Reviewed-by: Alex Gough <ajgo@chromium.org> Commit-Queue: Fred Shih <ffred@chromium.org> Cr-Commit-Position: refs/heads/main@{#1454211}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.