Meter Not Found Error (meter/errors.go)

openmeter · openmeter/meter/errors.go · go · Apache-2.0
dev-tools, payments, lang:go, tag:error-handling, tag:meter, tag:domain-error

Go error type wrapping a generic not-found error for meter resources. Reuse in billing/metering services for typed error handling and unwrapping.

// Source: https://github.com/openmeterio/openmeter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package meter

import (
	"errors"
	"fmt"

	"github.com/openmeterio/openmeter/pkg/models"
)

// NewMeterNotFoundError returns a new MeterNotFoundError.
func NewMeterNotFoundError(meterIDOrSlug string) error {
	return &MeterNotFoundError{
		err: models.NewGenericNotFoundError(
			fmt.Errorf("meter not found: %s", meterIDOrSlug),
		),
	}
}

var _ models.GenericError = &MeterNotFoundError{}

// MeterNotFoundError is returned when a meter is not found.
type MeterNotFoundError struct {
	err error
}

// Error returns the error message.
func (e *MeterNotFoundError) Error() string {
	return 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key