Browse Source

Address Copilot review feedback (round 3)

- Use CliUrls.WwwAbpIo instead of hardcoded abp.io host/URL in the
  401/403 license hint, so dev/staging environments show the right URL
- Include server-provided RemoteServiceErrorResponse details (e.g. Code:
  LicenseExpired) in the CliUsageException message when available
pull/25443/head
maliming 2 months ago
parent
commit
e3ccbb6fbe
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 19
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs

19
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs

@ -289,12 +289,19 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
{
if (responseMessage is { StatusCode: HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden })
{
throw new CliUsageException(
$"Remote server returns '{(int)responseMessage.StatusCode}-{responseMessage.ReasonPhrase}'. " +
"Authentication or license check failed while accessing abp.io. " +
"Please make sure you are logged in with `abp login <username>` and your ABP commercial license is active and covers the requested version. " +
"You can check your license at https://abp.io/my-organizations"
);
var message = $"Remote server returns '{(int)responseMessage.StatusCode}-{responseMessage.ReasonPhrase}'. ";
var serverError = await RemoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage);
if (!string.IsNullOrWhiteSpace(serverError))
{
message += serverError + " ";
}
message += $"Authentication or license check failed while accessing {CliUrls.WwwAbpIo}. " +
"Please make sure you are logged in with `abp login <username>` and your ABP commercial license is active and covers the requested version. " +
$"You can check your license at {CliUrls.WwwAbpIo}my-organizations";
throw new CliUsageException(message);
}
await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage);

Loading…
Cancel
Save