Coder Social home page Coder Social logo

Comments (2)

stackanthony avatar stackanthony commented on June 21, 2024

Hey @cicoyle, so looking through predefined.go I see that there's currently 5 different config related errors set in there. Should I only focus on migrating these over to the gRPC richer error model?

	// Configuration.
	ErrConfigurationStoresNotConfigured = "configuration stores not configured"
	ErrConfigurationStoreNotFound       = "configuration store %s not found"
	ErrConfigurationGet                 = "failed to get %s from Configuration store %s: %v"
	ErrConfigurationSubscribe           = "failed to subscribe %s from Configuration store %s: %v"
	ErrConfigurationUnsubscribe         = "failed to unsubscribe to configuration request %s: %v"

from dapr.

stackanthony avatar stackanthony commented on June 21, 2024

Just started working on this, made a new file pkg/api/errors/config.go, looks like this

package errors

import "github.com/dapr/kit/errors"

type ConfigurationError struct {
	name string
}

func Configuration(name string) *ConfigurationError {
	return &ConfigurationError{
		name: name,
	}
}

// func (c *ConfigurationError) StoresNotConfigured() error {
// 	return c.build(
//     errors.NewBuilder(grpcCode codes.Code, httpCode int, message string, tag string)
//     )
// }

func (c *ConfigurationError) build(err *errors.ErrorBuilder, errCode string, metadata map[string]string) error {
	return err.WithErrorInfo(errors.CodePrefixConfigurationStore+errCode, metadata).Build()
}

Wanted to make sure I'm on the right track. I've been looking through the codebase and the other error models that have been standardized have been a huge help thus far. Could I get some feedback?

from dapr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.