Getting exception information from QuickBooks Online - asp.net

Is there a way to get more specific information about the exception/error that occurred when interacting with QuickBooks Online?
I've been messing around and testing certain things and I would get an exception but all it would say is "BadRequest" from a IdsException, which isn't too helpful. So I was just curious if there was a way to extract more information. I know they put more information and such in the response body but since I'm using a DataService object I'm not sure how to see the response body.
I've checked Intuits documentation and checked all the properties and methods I could think to check but haven't had any luck so far.
If I need to put up an example of what I'm doing I can. Thanks for any help.

When sending information to QuickBooks Online and QuickBooks does not like what you are sending you will get a ValidationException.
This exception is clearly not too helpful as it is very vague. However, if you catch it and then look for the InnerExceptions array of IdsError you can find more information about what actually went wrong.
In my situation I would catch the main exception, ex, and have to do this:
ex.InnerException.InnerExceptions(i).Message
From there you can either display it or concat all the errors together or anything else you want.

Related

how to handle download request from a WebView using WebResourceRequestFilter blackberry Cascades

i want to handle any download request coming from Webview. how it is possible ? the documentation https://developer.blackberry.com/native/reference/cascades/bb__cascades__webresourcerequestfilter.html and https://developer.blackberry.com/native/reference/cascades/bb__cascades__webdownloadrequest.html are describing the parameters but couldn't figure out how to do it.
Your question is not clear on what you don't understand. Remember this is not a training forum, the idea is that you should try things, review the documentation and then ask specific questions to get the best out of a forum.
Moreover it is not clear whether you are trying to handle the download request at the Server, or capture the request before the download attempt leaves the BB.
I'm going to assume you want to display a web page on the BlackBerry but make sure that any resource requests that the page generates, are filtered by your program, so that you can supply the data (assuming you have it).
I implemented something like this a while ago and remember that it was not simple to figure out what was going on, but I played with it a bit and it all made sense.
I don't remember using WebDownloadRequest and can't really see how it helps in this case.
The key is WebResourceRequestFilter. You create your own WebResourceRequestFilter making sure you implement the required methods. Then you use WebPage::setNetworkResourceRequestFilter(WebResourceRequestFilter*) to make sure the webpage will ask your WebResourceRequestFilter for its resources. The first method the web page invokes is filterResourceRequest(), and the return from this invocation determines which other methods in your WebResourceRequestFilter, the Webage will invoke.
I suggest you implement a WebResourceRequestFilter, put some debugging in filterResourceRequest(), but always return FilterAction Accept, which means the web page will use its normal processing to obtain the resources. Then try various other FilterAction return values and see what happens...

Web API Help Samples - C#

ASP.NET Web API has an easy install Nuget help page with sample generator. It's easy to get it to generate and display sample requests, but not so easy it seems to get it to display sample responses (httpsampleresponses) so that when developers look at the help page they'd see examples of generated responses / not static/typed in responses, but actually generated. I've seen it done before on another project, but still having trouble figuring out how to do it. MSDN's YAO has a good blog but it's just not getting me all the way to success for some reason.
From what I've seen work live and based on what there is to read about it online, it's definitely in getting the HelpPageConfig file right in terms of the config.SetSampleResponses() set up. I've discovered the configuration file that sets the parameters for the SetSampleResponses() method, but still, nothing I try is working. It was suggested to me that I should create a custom type and use extension methods, but getting that to correspond and display what I need hasn't happened yet. I can get it to compile without errors, but it still doesn't show the generated response sample on the page. It was easy with the SetSampleForType piece to get a section to show up in the requests section, but it's the response part that has given me trouble.
Has anyone out there done this with the SetSampleResponses() successfully and is there any kind of trick you can clearly define for getting it to work? Do you have any tips on setting up a specific generic type and making that work?
I'm thinking this must be something really simple and I'm just not clicking to make it happen....
Thanks for any potential info...
SetSampleResponse extension on HelpPageConfig is for statically defining samples for you action.
config.SetSampleResponse("\"Hello World!\"", new MediaTypeHeaderValue("application/json"), "Values", "Get", "id");
if you are looking for generated sample for a particular type, have you tried using SetSampleObjects extension which allows you to set sample objects for different types and this same object is used in all cases where that particular type is returned from an action.
config.SetSampleObjects(new Dictionary<Type, object>
{
{typeof(string), "Hello World!"}
});
Could you share more specific(code) details as to how you are using SetSampleResponse extension?

How to request additional data with WER?

I'm new to WER (actually, just registered a few days ago).
I've managed to establish an account and map my test application to it.
However, when I invoke an unhandled exception, I see that no additional files are collected (there is proper report in Solutions center with BucketID <> 8, it is not arrived yet to winqual, but at least it was sent).
I expect that files like Version.txt, AppCompat.txt and minidump.mdmp will be collected. I also tried to add file by using WerRegisterFile function. No errors, but no files are sent either.
I've read this thread - it says that additional data is only collected, if server asks for it. So, my question is (may be it sounds stupid, but...): how can I request additional data? I've scanned everything in my profile, but the only useful options are related to product/file mappings.
I feel that this should be obvious (it's not discussed in help), but... I'm stuck :( A screenshot indicating where to look would be nice :)
It's strange that nobody have answered on that question, as the answer was a very simple :)
You can not collect any data for new errors. Error report should arrive on WinQual first. Then you can view a report (there is short info only) and ask server to collect files, dumps, additional info. Only then additional data will be collected.

Flex faultCode list

Is there a list of possible faultCode values for Flex's Fault object (mx.rpc.Fault; Flex SDK: 3.4)?
At least faultCodes for faults generated on the client side?
I'm thinking of something like the list of possible runtime errors, found at Adobe's RTE List, but for faultCodes (such as Client.Error.MessageSend, Server.Processing, etc).
Could very well be that I just don't understand my problem well enough to do a decent search, but I've come up with nothing all day. It may also be that there is only one or two client-side faultCode values. Seems like it would make sense that there wouldn't be a comprehensive list of server-side faultCode values, but maybe there's a list of BlazeDS/LiveCycle faultCodes?
Any help much appreciated.
So, it looks like the answer is pretty much "No". I guess this makes sense, I guess, since most server-side faults would come from the server. I figured there would be a list of standard fault types, at least, as part of BlazeDS and/or LCDS.
Here's a pretty good post about setting up exception handling in BlazeDS. Does a good job of explaining why the answer to this question is No, as well as providing a good way of handling exceptions in BlazeDS, which would give you a custom list of fault codes.
http://www.flexpasta.com/index.php/2008/05/16/exception-handling-with-blazeds-and-flex/
Maybe this may help:
There is what they called Fault Event(mx.rpc.events.FaultEvent)
its properties has:
var event:FaultEvent = new FaultEvent();
trace (event.message);
Try adding this in an array so that you could have ur list.
Hope it helps

Looking for a simple explanation on using trace logging

I have seen several projects that use the Trace functionality to capture events and stream them out to a log file. I have been unsuccessful in finding a simple to follow guide that will show me how to configure Trace to capture and write said logfile. Does anyone have a link recommendations, or provide some simple steps to follow?
The Trace object writes the statements to any attached TraceListeners. You can build your own, but there are a number already defined in the System.Diagnostics namespace, including:
ConsoleTraceListener (Console)
DefaultTraceListener (Visual Studio / Debugger)
DelimitedListTraceListener (TextWriter, special formatting)
EventLogTraceListener (EventLog - anything that inherits from System.Diagnostics.EventLog)
TextWriterTraceListener (TextWriter - think file)
You can, of course, inherit your own from the TraceListener class that writes to where ever you want. For example, you could log to a database, have it send e-mails or pages in certain situations, or write the statements back to a logging platform like log4net.
The big thing is that you need to create an instance of whatever listeners you want and then add them to the Trace' class Listeners collection. You can add as many as you need and Trace will write to all of them. This way, you can write your logging code once using a well-supported and understood object that's part of the framework, and you can attach anything you need to it.
I stumbled into a MSDN article that really helps. Sorry I didn't find it before posting the question but perhaps others may have the same question and haven't found this link.
Take a look at logging frameworks. We rolled out own, but are now migrating over to log4net available free at http://logging.apache.org/log4net/
Im looking for a way to set the Category of the EventLog, the FormattedEventLogTraceListener writes into (not the category of the message).
But I can't find an appropriate property of this class.
Is it possible to set this?

Resources