exception-handling

How can I programmatically launch visual studio and send it to a specific file / line?

狂风中的少年 提交于 2019-12-23 02:38:31
问题 I have a nice tidy way of capturing unhandled exceptions which I display to my users and (optionally) get emailed to myself. They generally look something like this: Uncaught exception encountered in MyApp (Version 1.1.0)! Exception: Object reference not set to an instance of an object. Exception type: System.NullReferenceException Source: MyApp Stack trace: at SomeLibrary.DoMoreStuff() in c:\projects\myapp\somelibrary.h:line 509 at SomeAlgothim.DoStuff() in c:\projects\myapp\somealgorithm.h

What is the correct way to nest exceptions? - Using Delphi

跟風遠走 提交于 2019-12-23 02:38:26
问题 Assume I have three (or more) procedures, some of which call each other, as shown below, any one of which can fail. If any one of them do fail I want the 'main' program to immediately log the failure and terminate the program. What is the correct syntax to use in Delphi to 'pass back' an exception to each preceeding procedure call? Even better if someone can help me to get the main program's Try/except block to identify which bit failed! Sample pseudo code of the three procedures and the main

webapi and unhandled exception hook per appdomain

早过忘川 提交于 2019-12-23 01:12:52
问题 Having a WebApi 2.2 application - is it possible to make use of AppDomain's UnhandledException hook? I have a code similar to this: [assembly: OwinStartup("DevConfiguration", typeof(DevStartup))] namespace WebApi.Module { public class DevStartup { private const string ErrorEventSourceName = "WebApiHost"; private const int ErrorEventId = 600; [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlAppDomain)] public void Configuration(IAppBuilder app) { AppDomain

Exceptions in Web Services

﹥>﹥吖頭↗ 提交于 2019-12-22 21:19:11
问题 My group is developing a service-based (.NET WCF) application and we're trying to decide how to handle exceptions in our internal services. Should we throw exceptions? Return exceptions serialized as XML? Just return an error code? Keep in mind that the user will never see these exceptions, it's only for other parts of the application. 回答1: WCF uses SoapFaults as its native way of transmitting exceptions from either the service to the client, or the client to the service. You can declare a

Modifying or Reraising Python error in C API

帅比萌擦擦* 提交于 2019-12-22 21:16:29
问题 I have a bit of code that tries to parse an object as an integer: long val = PyLong_AsLong(obj); if(val == -1 && PyErr_Occurred()) { return -1; } Here obj is a vanilla PyObject * , and PyLong_AsLong raises a very generic TypeError if obj is not an integer. I would like to transform the error message into something a bit more informative, so I would like to either modify the existing error object, or to reraise it. My current solution is to do this: long val = PyLong_AsLong(obj); if(val == -1

Modifying or Reraising Python error in C API

馋奶兔 提交于 2019-12-22 21:16:04
问题 I have a bit of code that tries to parse an object as an integer: long val = PyLong_AsLong(obj); if(val == -1 && PyErr_Occurred()) { return -1; } Here obj is a vanilla PyObject * , and PyLong_AsLong raises a very generic TypeError if obj is not an integer. I would like to transform the error message into something a bit more informative, so I would like to either modify the existing error object, or to reraise it. My current solution is to do this: long val = PyLong_AsLong(obj); if(val == -1

What's a good way for a c# dll to return error to the calling application?

戏子无情 提交于 2019-12-22 20:28:10
问题 i'm writing a dll which is a wrapper to a access database. and i'm pretty new to c# in general as my background is in web development LAMP with perl, i'm not sure what's a good way to return error to a calling app in case they pass the wrong parameters to my functions or what not. I have no idea as of now except to probably do some msgbox or throw some exceptions but i don't know where to start looking. Any help or resources would be more than useful :) thanks~ 回答1: You probably don't want to

How default exception handler work

不羁的心 提交于 2019-12-22 18:59:46
问题 When we try to run the following program then we get the error that Exception in thread "main" java.lang.ArithmeticException: / by zero class excp { public static void main(String args[]) { int x = 0; int a = 30/x; } } but when we ask somebody how these works, then he tell me that this exception is cautch by the default exception handler, So i could't understand how this defualt exception handler works. Plz elaborate this. 回答1: Quoting JLS 11 : 30/x - violates the semantic constraint of Java

Is it possible to have one Exception handler for multiple timers in a C# class?

僤鯓⒐⒋嵵緔 提交于 2019-12-22 18:48:10
问题 I have a C# program which runs a system tray application - transferring / moving / creating / editing files in the background. There is alot of exception handling and loop handling to prevent the program from crashing / getting stuck if the user manual deletes a file the program is working with. Unfortunately one of the computer the program is running on is having the program crash. The computer is very hard to get, and cannot have debugging software loaded on (it is an embedded PC outside

Throwing exceptions from JBPM WorkItemHandlers?

妖精的绣舞 提交于 2019-12-22 18:06:30
问题 I'm a little confused about the subject of throwing exceptions from JBPM work item handlers and handling the exception elsewhere in the business process. We're using JBPM 6.0.3 to run in Jboss EAP 6.1. The JBPM User Guide implies that you should never throw exceptions from within a WorkItemHandler. Instead, the handler should catch them and either handle them some way or else convert them to an error message, signal, or similar. JBPM even provides work item handler wrappers which catch