fix(cli) surface local fallback errors in deploy restart and reload
- commit
- 8d650c2868592a2ecf3030613999508ead0e8db0
- author
- bnema · · 2026-02-06 20:43 UTC
- parent
- 2b58860
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +5 -1
M internal/adapters/in/cli/deploy.go +1 -0
| @@ -42,6 +42,7 @@ Examples: | |||
| 42 | 42 | fmt.Println(styles.RenderSuccess(fmt.Sprintf("Deploy signal sent for domain: %s", domain))) | |
| 43 | 43 | return nil | |
| 44 | 44 | } | |
| 45 | + | return fmt.Errorf("failed to deploy: remote error: %w; local fallback also failed: %v", err, localErr) | |
| 45 | 46 | } | |
| 46 | 47 | return fmt.Errorf("failed to deploy: %w", err) | |
| 47 | 48 | } | |
| @@ -42,6 +42,7 @@ Examples: | |||||
| 42 | fmt.Println(styles.RenderSuccess(fmt.Sprintf("Deploy signal sent for domain: %s", domain))) | 42 | fmt.Println(styles.RenderSuccess(fmt.Sprintf("Deploy signal sent for domain: %s", domain))) | ||
| 43 | return nil | 43 | return nil | ||
| 44 | } | 44 | } | ||
| 45 | + | return fmt.Errorf("failed to deploy: remote error: %w; local fallback also failed: %v", err, localErr) | |||
| 45 | } | 46 | } | ||
| 46 | return fmt.Errorf("failed to deploy: %w", err) | 47 | return fmt.Errorf("failed to deploy: %w", err) | ||
| 47 | } | 48 | } | ||
M internal/adapters/in/cli/restart.go +1 -0
| @@ -50,6 +50,7 @@ Examples: | |||
| 50 | 50 | fmt.Println(styles.RenderSuccess(fmt.Sprintf("Restart signal sent for %s (local deploy path)", domain))) | |
| 51 | 51 | return nil | |
| 52 | 52 | } | |
| 53 | + | return fmt.Errorf("remote restart failed: %w; local fallback failed: %v", err, localErr) | |
| 53 | 54 | } | |
| 54 | 55 | return fmt.Errorf("failed to restart: %w", err) | |
| 55 | 56 | } | |
| @@ -50,6 +50,7 @@ Examples: | |||||
| 50 | fmt.Println(styles.RenderSuccess(fmt.Sprintf("Restart signal sent for %s (local deploy path)", domain))) | 50 | fmt.Println(styles.RenderSuccess(fmt.Sprintf("Restart signal sent for %s (local deploy path)", domain))) | ||
| 51 | return nil | 51 | return nil | ||
| 52 | } | 52 | } | ||
| 53 | + | return fmt.Errorf("remote restart failed: %w; local fallback failed: %v", err, localErr) | |||
| 53 | } | 54 | } | ||
| 54 | return fmt.Errorf("failed to restart: %w", err) | 55 | return fmt.Errorf("failed to restart: %w", err) | ||
| 55 | } | 56 | } | ||
M internal/adapters/in/cli/root.go +3 -1
| @@ -204,11 +204,13 @@ func runReload() error { | |||
| 204 | 204 | func runReloadRemote(ctx context.Context, client *remote.Client) error { | |
| 205 | 205 | if err := client.Reload(ctx); err != nil { | |
| 206 | 206 | if shouldFallbackToLocal(err) { | |
| 207 | - | if localErr := runReload(); localErr == nil { | |
| 207 | + | localErr := runReload() | |
| 208 | + | if localErr == nil { | |
| 208 | 209 | fmt.Printf("Remote reload failed (%v), used local signal fallback\n", err) | |
| 209 | 210 | fmt.Println("Configuration reloaded successfully") | |
| 210 | 211 | return nil | |
| 211 | 212 | } | |
| 213 | + | return fmt.Errorf("remote reload failed: %w; local fallback failed: %v", err, localErr) | |
| 212 | 214 | } | |
| 213 | 215 | return fmt.Errorf("failed to reload: %w", err) | |
| 214 | 216 | } | |
| @@ -204,11 +204,13 @@ func runReload() error { | |||||
| 204 | func runReloadRemote(ctx context.Context, client *remote.Client) error { | 204 | func runReloadRemote(ctx context.Context, client *remote.Client) error { | ||
| 205 | if err := client.Reload(ctx); err != nil { | 205 | if err := client.Reload(ctx); err != nil { | ||
| 206 | if shouldFallbackToLocal(err) { | 206 | if shouldFallbackToLocal(err) { | ||
| 207 | - | if localErr := runReload(); localErr == nil { | 207 | + | localErr := runReload() |
| 208 | + | if localErr == nil { | |||
| 208 | fmt.Printf("Remote reload failed (%v), used local signal fallback\n", err) | 209 | fmt.Printf("Remote reload failed (%v), used local signal fallback\n", err) | ||
| 209 | fmt.Println("Configuration reloaded successfully") | 210 | fmt.Println("Configuration reloaded successfully") | ||
| 210 | return nil | 211 | return nil | ||
| 211 | } | 212 | } | ||
| 213 | + | return fmt.Errorf("remote reload failed: %w; local fallback failed: %v", err, localErr) | |||
| 212 | } | 214 | } | ||
| 213 | return fmt.Errorf("failed to reload: %w", err) | 215 | return fmt.Errorf("failed to reload: %w", err) | ||
| 214 | } | 216 | } | ||