From 09a503fb0ccc023810334ecd9cbd984210016e71 Mon Sep 17 00:00:00 2001 From: Matt Spilchen Date: Thu, 4 Jan 2024 08:30:29 -0400 Subject: [PATCH] Sync from server repo (539e5da6554) --- vclusterops/https_check_db_running_op.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/vclusterops/https_check_db_running_op.go b/vclusterops/https_check_db_running_op.go index 762a8ab..d1f3657 100644 --- a/vclusterops/https_check_db_running_op.go +++ b/vclusterops/https_check_db_running_op.go @@ -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 @@ -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 {