Code Monkey home page Code Monkey logo

Comments (11)

ganler avatar ganler commented on September 24, 2024

so why do we want to catch the assertion error?

from nnsmith.

lazycal avatar lazycal commented on September 24, 2024

have we fixed this issue?

from nnsmith.

ganler avatar ganler commented on September 24, 2024

@lazycal You mean we shall replace all internal assertion exception into some kind of customized one, right?

from nnsmith.

lazycal avatar lazycal commented on September 24, 2024

yes

from nnsmith.

ganler avatar ganler commented on September 24, 2024

OK, let's use NNSmithInternalError. I will update my parts and send a PR soon.

from nnsmith.

ganler avatar ganler commented on September 24, 2024

@lazycal I forgot to make a PR so could manually take a look at 4fe4140 to see if that is what you expected?

from nnsmith.

ganler avatar ganler commented on September 24, 2024

@lazycal

46c8da3

Should look better now. Use SanityCheck.$FUNC() to do fatal check (i.e., internal errors). Use ConstraintCheck.$FUNC() to assert some constraint properties which can be expectedly caught if not sat.

Please consider closing this issue if nothing else.

from nnsmith.

lazycal avatar lazycal commented on September 24, 2024

Thanks. This works. I accept this commit.

One question for curiosity: what I initially wanted is much simpler. That is, we only create a new type of error ConstraintError but still use python's native AssertionError as NNSmithInternalError. I don't see any reason against it?

from nnsmith.

ganler avatar ganler commented on September 24, 2024

Because we have no idea if any other standard lib or 3rd-party lib will use AssertionError to mess things up. So it is always good to distinguish the Exception type when considering catching it as any sort of hints. @lazycal

from nnsmith.

lazycal avatar lazycal commented on September 24, 2024

Do you mean you want to ignore 3rd-party's assertionerror?

from nnsmith.

ganler avatar ganler commented on September 24, 2024

Oh, I see you mean internal error. All errors except ConstraintError should cause our attention. In this case, it is OK to use AssertionError. I use NNSmithInternalError just to make things consistent (it has been used elsewhere before).

from nnsmith.

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.