Skip to content

Commit 0f1443d

Browse files
committed
admin page url in the exception message
1 parent 5a897d5 commit 0f1443d

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

app/lib/frontend/templates/views/pkg/admin_page.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,12 @@ d.Node _manualPublishing(Package package) {
473473
return d.fragment([
474474
d.a(name: 'manual-publishing'),
475475
d.h3(text: 'Manual publishing'),
476-
d.markdown(
477-
'''
476+
d.markdown('''
478477
Manual publishing, using personal credentials for the `pub` client (`pub login`) .
479478
480479
Disable to prevent accidental publication from the command line.
481480
482-
It is recommended to disable when automated publishing is enabled.''',
483-
),
481+
It is recommended to disable when automated publishing is enabled.'''),
484482
d.div(
485483
classes: ['-pub-form-checkbox-row'],
486484
child: material.checkbox(

app/lib/package/backend.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ class PackageBackend {
16191619
final isEnabled =
16201620
package.automatedPublishing?.manualConfig?.isEnabled ?? true;
16211621
if (!isEnabled) {
1622-
throw AuthorizationException.manualPublishingDisabled();
1622+
throw AuthorizationException.manualPublishingDisabled(package.name!);
16231623
}
16241624
return;
16251625
}

app/lib/shared/exceptions.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ library;
1616
import 'dart:io';
1717

1818
import 'package:api_builder/api_builder.dart' show ApiResponseException;
19+
import 'package:pub_dev/shared/urls.dart';
1920
import 'package:pub_dev/shared/utils.dart';
2021

2122
/// Base class for all exceptions that are intercepted by HTTP handler wrappers.
@@ -573,10 +574,15 @@ class AuthorizationException extends ResponseException {
573574
);
574575

575576
/// Signaling that the manual publishing was disabled and cannot be authorized.
576-
factory AuthorizationException.manualPublishingDisabled() =>
577-
AuthorizationException._(
578-
'Manual publishing has been disabled. This usually means this package should be published via automated publishing (see https://dart.dev/tools/pub/automated-publishing). To re-enable manual publishing, go to the package admin page.',
579-
);
577+
factory AuthorizationException.manualPublishingDisabled(String package) {
578+
return AuthorizationException._(
579+
'Manual publishing has been disabled. '
580+
'This usually means this package should be published via automated publishing '
581+
'(see https://dart.dev/tools/pub/automated-publishing). '
582+
'To re-enable manual publishing, go to the package admin page '
583+
'(see ${pkgAdminUrl(package, includeHost: true)}).',
584+
);
585+
}
580586

581587
@override
582588
String toString() => '$code: $message'; // used by package:pub_server

0 commit comments

Comments
 (0)