Disallow getting logs from codespaces with pending ops
Since the API already disallows this, this pretty much just cleans up the error reporting to the user. Example of old error: ``` $ gh cs logs -c cwndrws-redacted Starting codespace ⣽connecting to codespace: error starting codespace: HTTP 422: your codespace has an operation pending: updating to a sku with a different amount of storage; please wait until this operation is complete (https://api.github.com/user/codespaces/cwndrws-redacted/start) exit status 1 ``` Example of new error: ``` $ gh cs logs -c cwndrws-redacted codespace is disabled while it has a pending operation: Changing machine types... exit status 1 ```
This commit is contained in:
parent
afa71c4b2f
commit
599c7c900f
1 changed files with 7 additions and 0 deletions
|
|
@ -41,6 +41,13 @@ func (a *App) Logs(ctx context.Context, codespaceName string, follow bool) (err
|
|||
return fmt.Errorf("get or choose codespace: %w", err)
|
||||
}
|
||||
|
||||
if codespace.PendingOperation {
|
||||
return fmt.Errorf(
|
||||
"codespace is disabled while it has a pending operation: %s",
|
||||
codespace.PendingOperationDisabledReason,
|
||||
)
|
||||
}
|
||||
|
||||
authkeys := make(chan error, 1)
|
||||
go func() {
|
||||
authkeys <- checkAuthorizedKeys(ctx, a.apiClient)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue