Neo: Update code to use custom Exception sub-classes

Created on 31 Jul 2019  路  6Comments  路  Source: neo-project/neo

Hello,

Any chance we can use custom Exception sub-classes to make errors handling more "accurate"? For instance, we may want to have different messages and different behavior for different exceptions.

Also, I was unable to catch exceptions in our UT. The exceptions don't seem to be released to the UT. I believe this is related to AKKA. Do you guys know how to get an exception when it occurs inside an Actor?

Tasks:

  • [ ] Create sub-classes
  • [ ] Update code to use these sub-classes and emit more error information (specially in RPC)
enhancement house-keeping neo3-preview3 ready-to-implement

Most helpful comment

@neo-project/core can I consider this ready to implement? I think we have enough votes? Thanks

All 6 comments

Yes please, also we should avoid in some cases the exceptions, throw exceptions are expensive

Voting for this suggestion. Cannot get exactly what goes wrong when sending rpc request.

@neo-project/core can I consider this ready to implement? I think we have enough votes? Thanks

Yes for me

Yes @lock9, that may be related to Akka, as you can see in the documentation https://doc.akka.io/docs/akka/2.5/actors.html#actors-and-exceptions
When an actor processing a message throws an exception, this message gets lost, so for dealing with errors inside the Akka system we need to treat our exceptions or use some error codes to handle it which is far faster, as @shargon already said.

Yes please, also we should avoid in some cases the exceptions, throw exceptions are expensive

What kind of exceptions were you trying to catch?

@rodoufu I'm trying to force some exceptions in some tests, but I can't make it work :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

csmuller picture csmuller  路  3Comments

shargon picture shargon  路  4Comments

igormcoelho picture igormcoelho  路  3Comments

roman-khimov picture roman-khimov  路  3Comments

vncoelho picture vncoelho  路  3Comments