This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Reduce code-duplication a bit and add more error context across SkiaGoldClient.
#51426
Merged
matanlurey
merged 1 commit into
flutter-team-archive:main
from
matanlurey:engine-skia-gold-throw-refactor
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /// Skia Gold errors thrown by intepreting process exits and [stdout]/[stderr]. | ||
| final class SkiaGoldProcessError extends Error { | ||
| /// Creates a new [SkiaGoldProcessError] from the provided origin. | ||
| /// | ||
| /// - [command] is the command that was executed. | ||
| /// - [stdout] is the result of the process's standard output. | ||
| /// - [stderr] is the result of the process's standard error. | ||
| /// | ||
| /// Optionally, [message] as context for the error. | ||
| /// | ||
| /// ## Example | ||
| /// | ||
| /// ```dart | ||
| /// final io.ProcessResult result = await _runCommand(someCommand); | ||
| /// if (result.exitCode != 0) { | ||
| /// throw SkiaGoldProcessError( | ||
| /// command: someCommand, | ||
| /// stdout: result.stdout.toString(), | ||
| /// stderr: result.stderr.toString(), | ||
| /// message: 'Authentication failed <or whatever we were doing>', | ||
| /// ); | ||
| /// } | ||
| /// ``` | ||
| SkiaGoldProcessError({ | ||
| required Iterable<String> command, | ||
| required this.stdout, | ||
| required this.stderr, | ||
| this.message, | ||
| }) : command = List<String>.unmodifiable(command); | ||
|
|
||
| /// Optional message to include as context for the error. | ||
| final String? message; | ||
|
|
||
| /// Command that was executed. | ||
| final List<String> command; | ||
|
|
||
| /// The result of the process's standard output. | ||
| final String stdout; | ||
|
|
||
| /// The result of the process's standard error. | ||
| final String stderr; | ||
|
|
||
| @override | ||
| String toString() { | ||
| return <String>[ | ||
| 'Error when running Skia Gold: ${command.join(' ')}', | ||
| if (message != null) message!, | ||
| '', | ||
| 'stdout: $stdout', | ||
| 'stderr: $stderr', | ||
| ].join('\n'); | ||
| } | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these uri's have the package in them instead of being relative paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly either way (would prefer a lint).
It appears we're intentionally opting out. I'll file a follow-up issue to suggest opting back in?