Is there any pattern for cross-platform error handling in MvvmCross, mainly Android and iOS?
For example:
In the model a call is made to a webservice. The call fails e.g. due to network not available.
Imagine a text input field that my application checks. When it contains abc, everything is fine. Otherwise an error message shall be shown.
How to propagate the error messages for these cases to the view? How to process the error message in the view?
Can someone provide some best practice samples?
Microsoft AppCenter Crashes has native and Xamarin modules for iOS and Android which will allow you to report and view handled and unhandled exceptions.
Polly can be used to handle automatic retry of web requests.
MvvmCross has a logging system that can be connected to NLog, Serilog, etc. to log errors/information to a log file on the device. You can attach the log file to AppCenter Error Report (although it is currently limited to 7MB file attachments)
FluentValidation can be used to validate objects. You could handle the validation in the ViewModel then use a MvvmCross Interaction to pass the validation errors from the ViewModel to the View. I use this approach and call TextInputLayout.SetError() in the Android view to show the error message next to the input field.
Related
Initially I thought that sentry gathers only those errors, which were proccessed with Sentry.captureException, so I created ErrorBoundary around my component, and when error inside of it happens, it triggers Sentry.captureException. But somewhy I get all the errors that occur inside my application, and it doesn't matter if I used captureException or not. So could you explain to me, why do need captureException then and how to disable gathering errors from the whole application? My Sentry.Init is simple, it contains only dsn.
I'm in the process of writing an app to interface with a service running on another machine. When I ask this service for some information, this service adds the requested information to a separate queue, and sends a windows message to the calling application (my application) indicating there is a message waiting in this separate queue which needs to be decoded.
The windows message this service sends is a custom message, defined in the service code as having some constant int value. I've found examples of creating custom events in wxpython, and using TryBefore() and TryAfter() to react to these events in specific ways, but I haven't found any way to associate this NewEvent() with an int value so I can identify it when it comes in, much less any way to determine what an int value of an incoming event is.
Has anyone done this before or know of any functions I'm not aware of? I'm using python 3.6 and wxpython 4.0.
Thanks for your help, everyone.
I think this is what you are looking for: https://wiki.wxpython.org/HookingTheWndProc
When you get the custom message from the hooked WndProc you can either react to it there, or you can turn it into a wx event and send it so it can be caught by binding an event handler like normal. The wx.lib.newevent module has some helpers for creating a custom event class and an event binder. Its use is demonstrated in some of the demo samples and library modules.
How can i send custom error report from Xamarin forms application to Hockey?
I am able to get crash reports through hockey sdk integration. I want to handle exceptions and send custom messages
to hockey.
I tried sending reports by this way.
HockeyApp.BITHockeyManager.SharedHockeyManager?.MetricsManager?.TrackEvent("custom error report");
I enabled hockey in app delegate in this way
var hocMgr = BITHockeyManager.SharedHockeyManager;
hocMgr.Configure("appKey");
hocMgr.DisableUpdateManager = true;
hocMgr.StartManager();
hocMgr.Authenticator.AuthenticateInstallation();
You can't just yet (see this recent link from support). HockeyApp is primarily designed for 'hard crashes' and not for event tracking or custom Exception handling. Besides the beta distribution and feedback of course.
With the merge of Xamarin Insights this will come, but it will take some time!
Custom event tracking is in the preseason already. But you'll have to be accepted in the program first.
I've currently inherited an application which has numerous Kendo grids (and other controls) throughout, and I'm trying to fix an error which keeps cropping up now and again - specifically when the user is no longer authenticated.
I know what the solution is for a single instance of the control - return a flag to indicate authentication failed, and then detect this in the error handler and perform the authentication.
The problem is am I really going to have to handle this for every instance of a Kendo control I have? Is there not a global error handler I can hook into? Either for the data source itself (as I know this is used for all Kendo control data loading), or for the Grid specificially. I don't mind either way - just which one is a hook.
This would be a more straighforward short term solution than refactoring everything to specific error handlers, etc.
I assume you can attach a global error handler to $.ajax, which is used by the DataSource, you can check how to do it here:
http://api.jquery.com/category/ajax/global-ajax-event-handlers/
Or, you can take advanttage of that the configuration that is done in the DataSource is passed directly to the $.ajax:
http://docs.kendoui.com/api/framework/datasource#configuration-transport.read-ObjectStringFunction
For reference, someone from Telerik has provided a solution using just the DataSource. I haven't tested it, but I prefer the accepted answer above as it hooked into all Ajax on the site - not just ones that utilise the Kendo DataSource.
http://www.kendoui.com/forums/mvc/grid/global-error-handler-for-numerous-grids.aspx
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