Skip to content

Commit

Permalink
Sync from server repo (539e5da6554)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Spilchen committed Jan 4, 2024
1 parent 91d1c33 commit 09a503f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion vclusterops/https_check_db_running_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ func (op opType) String() string {
return "unknown operation"
}

// DBIsRunningError is an error to indicate we found the database still running.
// This is emitted from this op. Callers can do type checking to perform an
// action based on the error.
type DBIsRunningError struct {
Detail string
}

// Error returns the message details. This is added so that it is compatible
// with the error interface.
func (e *DBIsRunningError) Error() string {
return e.Detail
}

type httpsCheckRunningDBOp struct {
opBase
opHTTPSBase
Expand Down Expand Up @@ -232,7 +245,7 @@ func (op *httpsCheckRunningDBOp) processResult(_ *opEngineExecContext) error {
}

// when db is running, append an error to allErrs for stopping VClusterOpEngine
return errors.Join(allErrs, errors.New(msg))
return errors.Join(allErrs, &DBIsRunningError{Detail: msg})
}

func (op *httpsCheckRunningDBOp) execute(execContext *opEngineExecContext) error {
Expand Down

0 comments on commit 09a503f

Please sign in to comment.