exception

WCF - Overhead of throwing FaultExceptions within your service

浪尽此生 提交于 2020-01-01 15:53:31
问题 I posted a question about using Messages versus Fault Exceptions to communicate business rules between services. I was under the impression it carried overhead to throw this exception over the wire, but considering it's just a message that get serialized and deserialized, they were in fact one and the same. But this got me thinking about throwing exceptions in general or more specifically throwing FaultExceptions. Now within my service, if i use throw new FaultException to communicate a

When is it appropriate to use C++ exceptions?

老子叫甜甜 提交于 2020-01-01 14:43:16
问题 I'm trying to design a class that needs to dynamically allocate some memory.. I had planned to allocate the memory it needs during construction, but how do I handle failed memory allocations? Should I throw an exception? I read somewhere that exceptions should only be used for "exceptional" cases, and running out of memory doesn't seem like an exceptional case to me.. Should I allocate memory in a separate initialization routine instead and check for failures and then destroy the class

AndroidManifest.xml (No such file or directory)----Error message in new Eclipse enviornment

混江龙づ霸主 提交于 2020-01-01 14:25:15
问题 Forum- After an importing a previously working package into my Eclipse IDE All of my packages started producing errors specifically about not being able to find the native library directory that contained the "ANDROID_FRAMEWORK". After some tinkering I decided that the best thing would be to start again and do a clean install of the IDE. I followed Google's instructions for installation http://developer.android.com/sdk/index.html Using the latest Helios version of Eclipse. I created a new

MySQL transaction conundrum

六月ゝ 毕业季﹏ 提交于 2020-01-01 12:15:15
问题 I need to perform several inserts in a single atomic transaction. For example: start transaction; insert ... insert ... commit; However when MySQL encounters an error it aborts only the particular statement that caused the error. For example, if there is an error in the second insert statement the commit will still take place and the first insert statement will be recorded. Thus, when errors occur a MySQL transaction is not really a transaction. To overcome this problem I have used an error

Catching exceptions in Java

混江龙づ霸主 提交于 2020-01-01 12:15:14
问题 There are certain predefined exceptions in Java, which, if thrown, report that something serious has happened and you'd better improve your code, than catching them in a catch block (if I have understood it correctly). But still I find many programs in which I have the following: } catch (IOException e) { ... } catch (FileNotFoundException e) { .... } and I thought that IOException and FileNotFoundException are exactly such kind of exceptions, which we shouldn't catch in a catch block. Why

Best Practice for Try Catch Error Handling

大兔子大兔子 提交于 2020-01-01 12:06:37
问题 I'm trying to avoid returning an incorrect value when in the catch but I'm having trouble finding a better solution than this: private SecurityLevel ApiGetSecurityLevel() { try { return _BioidInstance.GetSecurityLevel(); } catch { return SecurityLevel.High; } } Is there a better way of doing this so I don't return incorrect values? I can't change the SecurityLevel enum. 回答1: Do not catch the exception. Allow the exception to "bubble-up" to force the caller/callers to handle setting the

How can I check the failure in constructor() without using exceptions?

Deadly 提交于 2020-01-01 12:05:07
问题 All of the classes that I'm working on have Create()/Destroy() ( or Initialize()/Finalized() ) methods. The return value of the Create() method is bool like below. bool MyClass::Create(...); So I can check whether initialization of the instance is successful or not from the return value. Without Create()/Destroy() I can do the same job in constructor() and destructor() but I can't solve below problem. Can anyone help me? Thanks in advance. I cannot use exceptions because my company doesn't

WinDBG - Finding the actual (unmanaged) exception

允我心安 提交于 2020-01-01 11:51:33
问题 I'm trying to find the actual exception in a managed-unmanaged mixed code. The problem is that I have a .Net class that catches all unhandled exceptions and then creates a dump, so when i look at the dump there's mixed managed-unmanaged code, and i can't really get to the actual unmanaged exception. And to make things worse, the .Net seems to have its own exception so !analyze -v gives me that exception. So, here is what I have: I can find where the exception happened (by finding the 1003f

WinDBG - Finding the actual (unmanaged) exception

倾然丶 夕夏残阳落幕 提交于 2020-01-01 11:51:11
问题 I'm trying to find the actual exception in a managed-unmanaged mixed code. The problem is that I have a .Net class that catches all unhandled exceptions and then creates a dump, so when i look at the dump there's mixed managed-unmanaged code, and i can't really get to the actual unmanaged exception. And to make things worse, the .Net seems to have its own exception so !analyze -v gives me that exception. So, here is what I have: I can find where the exception happened (by finding the 1003f

Using bool (return Type) to handle exceptions or pass exception to client?

喜欢而已 提交于 2020-01-01 10:51:29
问题 I am trying to find out the best way of handling exceptions, I have a number of layers to my application and started to use a return type of BOOL i.e. if it fails then return False and if it succeeds return True.. This works great in methods like SaveMyRecord(somerecord); as i am passing in values and don't require anything returned so i can use the return type of bool to indicate if it succeeds or not. But then it got me thinking that things like GetMyRecord() actually returns type of