alexeyinkin commented on code in PR #26732:
URL: https://github.com/apache/beam/pull/26732#discussion_r1196177353


##########
playground/frontend/playground_components/assets/translations/en.yaml:
##########
@@ -26,6 +26,7 @@ errors:
   loading: 'Error while loading.'
   loadingCatalog: 'Cannot load the example catalog.'
   loadingExample: 'Cannot load the example.'
+  failedLoadExampleWithToken: 'Failed to load the example with the token: 
{token}.'

Review Comment:
   There is no concept of tokens to the end-user.
   ```suggestion
     failedLoadExampleWithToken: 'Failed to load the example: {token}.'
   ```



##########
playground/frontend/playground_components/lib/src/exceptions/example_loading_exception.dart:
##########


Review Comment:
   Rename this to `ExamplesLoadingException` because it is only thrown when 
trying to load multiple examples.
   
   ```dart
   /// Thrown when at least one example has failed to be loaded.
   ```



##########
playground/frontend/playground_components/lib/src/controllers/example_loaders/examples_loader.dart:
##########
@@ -142,7 +144,18 @@ class ExamplesLoader {
   }
 
   Future<void> _loadOne(ExampleLoader loader) async {
-    final example = await loader.future;
+    Example example;
+    try {
+      example = await loader.future;

Review Comment:
   ```suggestion
         final example = await loader.future;
   ```
   and continue the rest of the successful scenario within `try`.



##########
playground/frontend/playground_components/lib/src/controllers/example_loaders/examples_loader.dart:
##########
@@ -142,7 +144,18 @@ class ExamplesLoader {
   }
 
   Future<void> _loadOne(ExampleLoader loader) async {
-    final example = await loader.future;
+    Example example;
+    try {
+      example = await loader.future;
+    } on Exception catch (_) {

Review Comment:
   ```suggestion
       } on Exception {
   ```



##########
playground/frontend/playground_components/lib/src/controllers/example_loaders/examples_loader.dart:
##########
@@ -142,7 +144,18 @@ class ExamplesLoader {
   }
 
   Future<void> _loadOne(ExampleLoader loader) async {
-    final example = await loader.future;
+    Example example;
+    try {
+      example = await loader.future;
+    } on Exception catch (_) {
+      throw Exception(

Review Comment:
   Would be nice to have `ExampleLoadingException` class with `token` as a 
property. It's not the loader's job to be translation-aware.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to