-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Don't throw when omnibox.prompt is dimissed
The current semantic of the Omnibox API rejects a promise when the prompt is dismissed (Which is the async-equivalent of throwing). This is unideal for various reasons: - Practically: it caused the the codebase to pollute with try/catch blocks that end up suppressing any exception usually in larger scopes, hiding bugs. Virtually nobody wants to deal with exceptions for something that fine grained, and the current state of the codebase reflects that (i.e. everybody ended up over-catching). - This is very error prone: when somebody adds some new code that uses .prompt() they will not realize the subtlety of "if the user presses Esc, this will throw". This behaviour is very undiscoverable, and will lead with a lot of plugins just crashing when the user dimisses the prompt. - Philosophically: exceptions should be used for "exceptional" conditions, typically errors. The user dismissing a prompt is not exceptional. Hence changing the return type into string|undefined, which is more expected. Change-Id: Icee41be84bd2ad0c717b71e3571e0c7f50d8412c
- Loading branch information
Showing
6 changed files
with
48 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters