I've seen many wrappers for the Windows API (MFC, ATL, WTL, etc.) but none of them seem to use exception-handling -- you still have to check the error codes for most functions, which is easy to forget (or to omit due to laziness).
Is there any wrapper out there that actually throws exceptions instead of returning error codes?
The VCL raises exceptions when it encounters errors.
Related
I am getting below error while compiling my test cases derived from testing::Test of google test with C++11. Below error will be thrown if my derived class has HippoMock::MockRepository member.
looser throw specifier for virtual MyTestClass::~MyTestClass
noexcept(false) error overriding 'virtual testing::Test::~Test()
noexcept(true)'
This error is reported since HippoMock::MockRespository destructor throws exception and define as noexcept(false), However google test destructor defined as 'virtual testing::Test::~Test()'
Resolution:
Mark all derived destructor as noexcept(false). However this is
not feasible and may cause crash since HippoMock::MockRepository throws
exception from destructor.
Declare google test testing::Test::~Test() noexcept(false). However
I really don`t know the consequences, Also our newer code using
google Mock.
Please note since legacy code contain lot of HippoMocks code its not feasible to replace all with Google Mock. Also newer code is using google mock.
I just want to know ,
What are the consequences of defining gtest testing::Test::~Test() noexcept(false) ?
This has resolved by updating to latest version of HippoMocks
https://github.com/dascandy/hippomocks.
I'm trying to use Twilio IP Messaging in a simple Xamarin Android project, but unfortunately running into issues with the latest Nuget libraries: Twilio.Common (v. 0.3.4.2) and Twilio.IPMessaging (I tried both 0.15.0.4 and 0.15.0.6).
My setup is complicated by the fact that the online Xamarin samples are obsoleted within the recent library releases --- so instead of calling methods to Initialize the Twilio SDK, my code simply invokes Twilio.IPMessaging.IPMessagingClient.Create. The input parameters are a bit unclear, but reading elsewhere I'm trying to bind using a signature:
IPMessagingClient IPMessagingClient.create(
Context context,
AccessManager accessManager,
IPMessagingClient.Properties clientProperties,
Constants.CallbackListener<IPMessagingClient> listener)
Invoking it this way, I invariably receive an error message: NoSuchMethodError with details:
"no static method \"Lcom/twilio/ipmessaging/IPMessagingClient;.create(Landroid/content/Context;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lcom/twilio/ipmessaging/IPMessagingClient;\"
Any ideas? I like the idea of using Twilio, but between the outdated documentation and unfortunate crashes it's looking simpler to just implement messaging myself.
While I check nugets can you provide more insights
why IPMessagingClient.create(...) and not IPMessagingClient.Create(...)?
Is linker turned on? Turn it off please. Then check.
Signature is
public static IPMessagingClient Create (Context context, Object acess_manager, Object properties, Object listener);
So far I've tried comparing Parse.Promise, Q and Bluebird but I haven't been able to get an error or catch block to handle/capture an async runtime error.
If you believe that one of the libraries mentioned above, can handle/capture async runtime errors and suspect that I may not have written my sample code correctly, please feel free to point out any mistakes: https://github.com/pulkitsinghal/example-promises
Otherwise I'm looking for suggestions for other promise libraries or frameworks to explore.
It is simply impossible for a library to handle errors beyond its control. The only reason promise libraries are throw safe is because promises use return values to assimilate other promises.
If all your code returns promises instead of callbacks, All A+ promise libraries (that's Q and Bluebird in your example but not Parse.promise) will catch runtime errors and bluebird will even report them automatically without the need to .catch them.
Domains are being deprecated and don't really work well in practice and there is no node-wide solution. Your only option really is to stick to promises app-wide. You must kill and restart the server on an uncaught exception since some parts in node code that throw those do not clean very well after themselves when they throw (this is part of why domains are deprecated to begin with).
So:
Promises are throw safe for runtime errors if you use promises app-wide.
If you have to run untrusted code that might throw consider running it in a VM using the vm module.
Sometimes there are node errors that leave you no choice but to restart a server.
Promisify at the lowest level possible to avoid promisified functions throwing.
Here is a broader question that discusses async error-handling in NodeJS.
I'm from an Android background and when looking up a method in the Android developers reference, the information usually includes what exceptions the method can throw (as well as the parameters the method takes in and its return type). I've had a browse of some classes in the MSDN library and this doesn't seem to be the case here. So how, when developing, can I determine what exceptions a method can throw (if it throws any exceptions)?
A concrete example is the DataContext.SubmitChanges() method (MSDN link), which can throw an SqlCeException exception. It seems there's no way of picking up on this unless it's encountered accidentally at run-time.
.NET is a bit different than java in exceptions. There is no throws syntax, where you have to declare what types of exceptions can be thrown from the method. Every method can possibly throw any kind of exception. That's why not always MSDN documentation contains that kind of data.
When you can't find list of possible exceptions on MSDN pages you can search/ask about it on sites like stackoverflow (eg. for DataContext.SubmitChanges()) or just test your app and try to generate the exception to check what type it is.
There is no equivalent to the throws keyword in .net, but you can tell your user what exceptions you know your method may throw in your doc-comments (C# equivalent to java doc)
VB 6.0 does not have any global handler.To catch runtime errors,we need to add a handler in each method where we feel an error can occur.But, still some places might be left out.So,we end up getting runtime errors.Adding error handler in all the methods of an application,the only way?
No there is no way to add a global error handler in VB6. However, you do not need to add an error handler in every method. You only really need to add an error handler in every event handler. E.g. Every click event,load event, etc
While errors do propogate upwards, VB6 has no way to do a stack trace, so you never know which method raised the error. Unfortunately, if you need this information, you have to add a handler to each method just to log where you were.
Also: errors do propagate upwards: if method X calls methods Y and Z, a single error handler in method X will cover all three methods.
I discovered this tool yesterday:
http://www.everythingaccess.com/simplyvba-global-error-handler.htm
It is a commercial product that enables global error handling in VB6 and VBA applications.
It has its cost but does its job perfectly. I have seen other tools (free though) helping in this VB6 mangle, but none can cover a true real global error handling like "SimplyVB6 Global Error Handler for VB6" does.
With "SimplyVB6 Global Error Handler for VB6", there is no need to change any line of existing code, and no need to number the lines of code (via a plug-in or something).
Just enable Global error handling (one line of code in the main module) and you are all set.
"SimplyVB6 Global Error Handler for VB6":
can show the call stack with real module and function names, as well as display the source code line.
Works only with P-Code compiled VB6 programs.
can work via early or late binding (no DLL Hell).
I am not in any way affiliated to www.everythingaccess.com, just happy to have found it yesterday afternoon, was kind of looking at this problem again as one of my customers was having bugs in our VB6 application. I was able to test the tool yesterday afternoon, exchanging emails with the www.everythingaccess.com support and getting the evaluation product per mail.
Their web side does not allow yet to download the evaluation version of the VB6 product, you have to email them but they are answering in less than an hour.
on error resume next - is kinda close but its been a while.
you might want to look up any caveats