Skip to content
Snippets Groups Projects
Commit 153a67e3 authored by Sergey Kolchenko's avatar Sergey Kolchenko Committed by Natalie Weizenbaum
Browse files

Handle http errors trying to find package (#1552)

parent a6fc90b2
No related branches found
No related tags found
No related merge requests found
......@@ -315,9 +315,17 @@ class BoundHostedSource extends CachedSource {
/// Always throws an error, either the original one or a better one.
void _throwFriendlyError(
error, StackTrace stackTrace, String package, String url) {
if (error is PubHttpException && error.response.statusCode == 404) {
throw new PackageNotFoundException(
"Could not find package $package at $url.", error, stackTrace);
if (error is PubHttpException) {
if (error.response.statusCode == 404) {
throw new PackageNotFoundException(
"Could not find package $package at $url.", error, stackTrace);
}
fail(
"${error.response.statusCode} ${error.response.reasonPhrase} trying "
"to find package $package at $url.",
error,
stackTrace);
}
if (error is io.SocketException) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment