Closed Bug 1786468 Opened 2 years ago Closed 2 years ago

[meta] DoSomethingResult etc should be wrapped as `Result<DoSomethingResult, nsresult>`

Categories

(Core :: DOM: Editor, task, P3)

task

Tracking

()

RESOLVED FIXED
Tracking Status
firefox107 --- fixed

People

(Reporter: masayuki, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: meta)

Currently, *Result classes of editor such as CreateElementResult have error state. However, it's not useful if the caller's return type is Result<Something, nsresult>, and they duplicates getter/checker method of error state. Therefore, they should not have error state and used as the success value.

E.g.,

Result<CreateElementResult, nsresult> result = DoSomething();
if (result.isErr()) {
  return Err(result.unwrapErr());
}
RefPtr<Element> newElement = result.UnwrapNewNode();
result.IgnoreCaretPointSuggestion();

should be:

CreateElementResult result = DoSomething();
if (result.isErr()) {
  return Err(result.unwrapErr());
}
RefPtr<Element> newElement = result.inspect().UnwrapNewNode();
result.inspect().IgnoreCaretPointSuggestion();
Keywords: meta
Summary: CreateElementResult etc should be wrapped as `Result<CreateElementResult, nsresult>` → [meta] DoSomethingResult etc should be wrapped as `Result<DoSomethingResult, nsresult>`
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.