Skip to content

Commit

Permalink
feat: introduce NotReadableException
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 27, 2024
1 parent d6acedc commit c04303d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/src/core/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//
// SPDX-License-Identifier: BSD-3-Clause

export "exceptions/web_idl.dart";

/// Base class for custom exceptions defined in `dart_wot`.
base class DartWotException implements Exception {
/// Constructor.
Expand Down
20 changes: 20 additions & 0 deletions lib/src/core/exceptions/web_idl.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2024 Contributors to the Eclipse Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// SPDX-License-Identifier: BSD-3-Clause

import "../exceptions.dart";

/// Indicates that an I/O read operation failed.
///
/// Corresponds with the Web IDL exception type [NotReadableError].
///
/// [NotReadableError]: https://webidl.spec.whatwg.org/#notreadableerror
final class NotReadableException extends DartWotException {
/// Instantiates a new [NotReadableException] with the given [message].
NotReadableException(super.message);

@override
String get exceptionType => "NotReadableException";
}
5 changes: 5 additions & 0 deletions test/core/exceptions_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ void main() {
DiscoveryException("test").toString(),
"DiscoveryException: test",
);

expect(
NotReadableException("test").toString(),
"NotReadableException: test",
);
});
});
}

0 comments on commit c04303d

Please sign in to comment.