2024-12-30 09:38:18 +00:00
|
|
|
import 'package:platform_pipeline/pipeline.dart';
|
2024-12-31 03:39:19 +00:00
|
|
|
import 'package:platform_container/container.dart';
|
|
|
|
import 'package:platform_container/mirrors.dart';
|
2024-12-30 09:38:18 +00:00
|
|
|
|
|
|
|
class ErrorPipe {
|
2024-12-31 03:39:19 +00:00
|
|
|
dynamic handle(dynamic input, Function next) {
|
|
|
|
throw Exception('Simulated error in pipeline');
|
2024-12-30 09:38:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void main() async {
|
2024-12-31 03:39:19 +00:00
|
|
|
var container = Container(MirrorsReflector());
|
|
|
|
var pipeline = Pipeline(container);
|
2024-12-30 09:38:18 +00:00
|
|
|
|
2024-12-31 03:39:19 +00:00
|
|
|
try {
|
|
|
|
var result = await pipeline.send('World').through([ErrorPipe()]).then(
|
|
|
|
(result) => result.toString().toUpperCase());
|
2024-12-30 09:38:18 +00:00
|
|
|
|
2024-12-31 03:39:19 +00:00
|
|
|
print('This should not be printed');
|
|
|
|
} catch (e) {
|
|
|
|
print('Caught error: $e');
|
|
|
|
}
|
2024-12-30 09:38:18 +00:00
|
|
|
}
|