Code Monkey home page Code Monkey logo

Comments (4)

SantiagoTorres avatar SantiagoTorres commented on August 15, 2024

This sounds like a better, more idomatic way to do error handling. It also sounds it'd be super helpful to improve testing.

Is there a way to do this gradually?

from in-toto-golang.

shibumi avatar shibumi commented on August 15, 2024

@SantiagoTorres Yes, I just pushed 3 new error types in my latest in-toto-run commit. The error handling gets so much better with this.

We get basically from something like this:

        expectedError := "Could not find a public key PEM block"
	err = key.LoadRSAPublicKey("demo.layout.template")
	if err == nil || !strings.Contains(err.Error(), expectedError) {
		t.Errorf("LoadRSAPublicKey returned (%s), expected '%s' error", err,
			expectedError)
	}

to:

        err = key.LoadRSAPublicKey("demo.layout.template")
	if !errors.Is(err, ErrNoPEMBlock) {
            t.Errorf("LoadRSAPublicKey returned (%s), expected '%s' error", err,
			ErrNoPEMBlock.Error())
	}

from in-toto-golang.

lukpueh avatar lukpueh commented on August 15, 2024

Cross-referencing with #5.

from in-toto-golang.

sarthaksarthak9 avatar sarthaksarthak9 commented on August 15, 2024

@shibumi is this issue still up ?

from in-toto-golang.

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.