Skip to content

Commit

Permalink
Annotate fail with @alwaysThrows, Remove unreachable throws (#1763)
Browse files Browse the repository at this point in the history
dart-lang/sdk#31384 was fixed in
dart-lang/sdk@0a6253312f

Available in Dart 2.0.0-dev.12.0
  • Loading branch information
kevmoo authored and nex3 committed Dec 18, 2017
1 parent 6cc3d5a commit 35730f7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/src/barback/transformer_isolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class TransformerIsolate {
// failed was the one we were loading transformers from, throw an
// application exception with a more user-friendly message.
fail('Transformer library "$packageUri" not found.', error, stackTrace);
return null;
}
}

Expand Down
3 changes: 0 additions & 3 deletions lib/src/pubspec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,6 @@ class Pubspec {
if (node == null || node.value == null) return new YamlList();
if (node is YamlList) return node;
_error('Must be a list.', node.span);

// TODO(nweiz): Remove this when sdk#31384 is fixed.
throw "Unreachable";
}

/// Runs [fn] and wraps any [FormatException] it throws in a
Expand Down
2 changes: 2 additions & 0 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'dart:io';
import 'dart:math' as math;

import "package:crypto/crypto.dart" as crypto;
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
import "package:stack_trace/stack_trace.dart";

Expand Down Expand Up @@ -725,6 +726,7 @@ String yamlToString(data) {
}

/// Throw a [ApplicationException] with [message].
@alwaysThrows
void fail(String message, [innerError, StackTrace innerTrace]) {
if (innerError != null) {
throw new WrappedException(message, innerError, innerTrace);
Expand Down
1 change: 0 additions & 1 deletion test/descriptor_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class DescriptorServer {
_server.mount((request) {
fail("The HTTP server received an unexpected request:\n"
"${request.method} ${request.requestedUri}");
return new shelf.Response.forbidden(null);
});
addTearDown(() => _server.close());
}
Expand Down

0 comments on commit 35730f7

Please sign in to comment.