File tree Expand file tree Collapse file tree 4 files changed +129
-60056
lines changed
src/Nitro/CommandLine/src/CommandLine Expand file tree Collapse file tree 4 files changed +129
-60056
lines changed Original file line number Diff line number Diff line change @@ -177,14 +177,18 @@ public static async Task<FusionSourceSchemaArchive> DownloadSourceSchemaArchiveA
177177
178178 var response = await httpClient . SendAsync ( request , cancellationToken ) ;
179179
180- if ( response . StatusCode == HttpStatusCode . NotFound )
180+ if ( response . StatusCode is HttpStatusCode . Unauthorized or HttpStatusCode . Forbidden )
181181 {
182- // TODO: Properly handle
182+ throw new ExitException (
183+ $ "Got a HTTP { response . StatusCode } while attempting to download source schema '{ sourceSchemaName } ' in version '{ sourceSchemaVersion } '. "
184+ + "Make sure that you have the proper credentials / permissions to execute this command." ) ;
183185 }
184186
185- if ( response . StatusCode == HttpStatusCode . Unauthorized )
187+ if ( response . StatusCode is HttpStatusCode . NotFound )
186188 {
187- // TODO: Properly handle
189+ throw new ExitException (
190+ $ "Got a HTTP { HttpStatusCode . NotFound } while attempting to download source schema '{ sourceSchemaName } ' in version '{ sourceSchemaVersion } '. "
191+ + "Make sure you've properly uploaded a source schema version before running this command." ) ;
188192 }
189193
190194 response . EnsureSuccessStatusCode ( ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,24 @@ public FusionValidateCommand() : base("validate")
2828 AddOption ( Opt < SourceSchemaFileListOption > . Instance ) ;
2929 this . AddNitroCloudDefaultOptions ( ) ;
3030
31+ AddValidator ( result =>
32+ {
33+ var exclusiveOptionsCount = new [ ]
34+ {
35+ result . FindResultFor ( Opt < SourceSchemaFileListOption > . Instance ) is not null ,
36+ result . FindResultFor ( archiveOption ) is not null
37+ } . Count ( x => x ) ;
38+
39+ if ( exclusiveOptionsCount > 1 )
40+ {
41+ result . ErrorMessage = "You can only specify one of: '--source-schema-file' or '--archive'." ;
42+ }
43+ else if ( exclusiveOptionsCount < 1 )
44+ {
45+ result . ErrorMessage = "You need to specify one of: '--source-schema-file' or '--archive'." ;
46+ }
47+ } ) ;
48+
3149 this . SetHandler (
3250 ExecuteAsync ,
3351 Opt < StageNameOption > . Instance ,
@@ -52,11 +70,6 @@ private static async Task<int> ExecuteAsync(
5270 {
5371 console . Title ( $ "Validate against { stageName . EscapeMarkup ( ) } ") ;
5472
55- if ( archiveFile is not null && sourceSchemaFiles . Count > 0 )
56- {
57- throw new ExitException ( "You can not specify both '--source-schema-file' and '--archive'." ) ;
58- }
59-
6073 var isValid = false ;
6174
6275 if ( console . IsHumanReadable ( ) )
You can’t perform that action at this time.
0 commit comments