c++ - Error interface in cpp -
I am preparing a software that has two logical layers, A and B Layer B has set the objects. is. Layer AA uses the set of highlighted APIs by layer B object to retrieve information. I want to design a generic error interface in layer B objects which can highlight layer A. What would be the best way to write a common error interface?
What would be enough to add anonymity for error interfacing?
In addition to this,
The sample signature for the Layer B API can be one of the following:
error_interface sample_API (RGS) , Zero * return_value);
or
(this return value is) zero * sample_API (args, error_interface * err);
Which of the following two signatures will be the priority? & Amp; Why?
Adding it,
will be some error code which will be normal for all level B objects. Some error codes will be specific to some of the B objects here how to create error hierarchy? I think the rule can not be used to create error hierarchy? Does a good idea of error class hierarchy arise?
Traditionally, error codes are often returned in the form of changed value, if any. Choose whatever you like best
As an error interface, you can use exception type trees instead of counting. For example, std :: runtime_error & gt; Base Execution B & gt; SomeSpecificErrorOfB
. Exceptions cause loss of speed, but I often use them because they should be handled by . Handling returns values should always be obvious - that is, if you forget to check any errors, as a programmer, no one will notice.
If you want to see the C ++ standard exception, then this could be a good start point, it is showing how to get an exception type from std :: runtime_error
Do and hold the exception of that type.
Comments
Post a Comment