Skip to content

app: unify 'not initialized' / 'not deployed' error phrasing across commands #106

@crowdy

Description

@crowdy

Background

PR #103 added mode-aware dispatch to nine `app` commands. Each site emits its own error for the "no marker" and "no CURRENT_SLOT" states, using different phrasing:

Site Message
`deploy.go:60` (no-proxy) `app %q not initialized on this server — run 'conoha app init --no-proxy --app-name %s %s' first`
`deploy.go:171` (proxy) `app %q not initialized on this server — run 'conoha app init %s' first`
`rollback.go:56` `app %q not initialized on this server — run 'conoha app init' first`
`logs/stop/restart/status` `app %q has not been initialized on this server` (no recovery hint)
`logs/stop/restart` (slot check) `app %q has not been deployed on this server`
`formatModeConflictError` (mode.go:73) `... # re-initialize in %s mode` — embeds a literal `` token rather than the real server ID

Proposal

Add two helpers in `cmd/app/mode.go`:

```go
// notInitializedError returns the canonical error for "no .conoha-mode marker".
// If mode is non-empty, the recovery hint includes the right --no-proxy flag.
func notInitializedError(app, serverID string, mode Mode) error

// notDeployedError returns the canonical error for "marker present but
// CURRENT_SLOT absent" (= app was never deployed).
func notDeployedError(app string) error
```

Also thread `serverID` through `formatModeConflictError` so the printed recovery commands reference the actual server.

Acceptance

  • All "not initialized" / "not deployed" errors across the `app` subcommands go through one helper each.
  • `formatModeConflictError` prints the real server ID instead of ``.
  • Tests updated to assert the new helper output.

Pointer

Surfaced by review on PR #103 (items M1, M2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions