Closed
Bug 1637599
Opened 4 years ago
Closed 4 years ago
Simplify propagation of errors with mozilla::Result
Categories
(Core :: MFBT, task)
Core
MFBT
Tracking
()
RESOLVED
FIXED
mozilla78
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: sg, Assigned: sg)
Details
Attachments
(2 files)
It would be convenient to be able to write:
Result<T1, E> Func1() {
Result<T2, E> res = Func2();
if (res.isErr()) { return res.propagateErr(); }
}
instead of
Result<T1, E> Func1() {
Result<T2, E> res = Func2();
if (res.isErr()) { return Err(res.unwrapErr()); }
}
Assignee | ||
Comment 1•4 years ago
|
||
Assignee | ||
Comment 2•4 years ago
|
||
The phrase "copy the error" is misleading, as the error type might not be
copyable, and it is never copied but moved. "Propagate" the error seems to
be a good term to describe this.
Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dbe6c4ba7987 Simplify propagation of error results. r=froydnj https://hg.mozilla.org/integration/autoland/rev/d469a49a225c Rephrase documentation referring to copies of errors. r=froydnj
Comment 4•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/dbe6c4ba7987
https://hg.mozilla.org/mozilla-central/rev/d469a49a225c
Status: NEW → RESOLVED
Closed: 4 years ago
status-firefox78:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in
before you can comment on or make changes to this bug.
Description
•