Skip to content

Commit fb523c5

Browse files
feat: add exceptions to the public API (#8)
Fixes #6
1 parent 0c8c7e1 commit fb523c5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

lib/native_toolchain_rs.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import 'package:native_toolchain_rs/src/crate_resolver.dart';
77
import 'package:native_toolchain_rs/src/process_runner.dart';
88
import 'package:native_toolchain_rs/src/toml_parsing.dart';
99

10+
export 'package:native_toolchain_rs/src/exception.dart';
11+
1012
/// The mode to build the Rust crate with.
1113
enum BuildMode {
1214
/// Build in release mode; i.e., `cargo build --release`

lib/src/build_runner.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:hooks/hooks.dart';
55
import 'package:logging/logging.dart';
66
import 'package:native_toolchain_rs/native_toolchain_rs.dart';
77
import 'package:native_toolchain_rs/src/crate_resolver.dart';
8-
import 'package:native_toolchain_rs/src/exception.dart';
98
import 'package:native_toolchain_rs/src/process_runner.dart';
109
import 'package:native_toolchain_rs/src/toml_parsing.dart';
1110
import 'package:path/path.dart' as path;

lib/src/exception.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ import 'package:meta/meta.dart';
55
// NOTE: the API for our exceptions is currently experimental
66
// ignore_for_file: public_member_api_docs
77

8-
/// # WARNING
9-
/// This is experimental!
10-
/// It may change on any new release without notice!
11-
/// Please file an issue with your use-case for it, if you do use it.
12-
@experimental
8+
/// An [Exception] representing a failure while trying to build Rust assets.
139
sealed class RustBuildException implements Exception {}
1410

1511
/// # WARNING
@@ -67,3 +63,8 @@ final class RustProcessException implements RustBuildException {
6763
'innerProcessException: ${inner ?? 'none'}'
6864
')';
6965
}
66+
67+
// NOTE: this is here so that end-users can't exhaustively pattern match
68+
// (and thus gives us some API flexibility for new types)
69+
// ignore: unused_element
70+
final class _NoBreakingChangeForNewExceptions implements RustBuildException {}

0 commit comments

Comments
 (0)