45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package merrors
|
|
|
|
import "strings"
|
|
|
|
const (
|
|
ReasonDocumentsReportOwned = "DOCUMENTS_REPORT_OWNED"
|
|
ReasonDocumentsQuotationExpired = "DOCUMENTS_QUOTATION_EXPIRED"
|
|
)
|
|
|
|
var ErrDocumentsReportOwned = Define("documents.report_owned")
|
|
|
|
var ErrDocumentsQuotationExpired = Define("documents.quotation_expired")
|
|
|
|
// DocumentsReportOwned reports that an active or settled payout owns a
|
|
// report, so callers must not mutate its document lifecycle.
|
|
func DocumentsReportOwned(msg string) error {
|
|
msg = strings.TrimSpace(msg)
|
|
if msg == "" {
|
|
msg = "report is owned by a payout"
|
|
}
|
|
return classifiedError{
|
|
base: ErrDataConflict,
|
|
code: ErrDocumentsReportOwned,
|
|
msg: msg,
|
|
reason: ReasonDocumentsReportOwned,
|
|
publicMessage: true,
|
|
}
|
|
}
|
|
|
|
// DocumentsQuotationExpired reports that a payout registry still references
|
|
// a quotation which can no longer be executed. A fresh quotation is required.
|
|
func DocumentsQuotationExpired(msg string) error {
|
|
msg = strings.TrimSpace(msg)
|
|
if msg == "" {
|
|
msg = "the payout quotation has expired; request a new quotation"
|
|
}
|
|
return classifiedError{
|
|
base: ErrFailedPrecondition,
|
|
code: ErrDocumentsQuotationExpired,
|
|
msg: msg,
|
|
reason: ReasonDocumentsQuotationExpired,
|
|
publicMessage: true,
|
|
}
|
|
}
|