exception-handling

using Fail-fast approach when developing modular applications

孤街醉人 提交于 2019-12-11 07:56:40
问题 When developing modular applications is it quiet obvious that we need to use Fail-fast systems? When creating modules if there is an error condition the module cannot handle, it should report the error(like throw an exception..)without worrying who will handle it. It looks like this can be used as a guideline when developing modules. Is there any issues with this? Edit :Example In module.dll public class SomeClass:ISomeInterface { public void CreateFile(string filename) { //The module have no

Exception found trying to parseDouble

痴心易碎 提交于 2019-12-11 07:28:30
问题 I am trying to make an app to calculate CGPA. I have used my numeric data to save in Double variable type. On executing, it showed java.lang.NumberFormatException: Invalid double: "" error on my logcat. It showed error on this segment of code: total_credit = Double.parseDouble(ch1.getText().toString()) + Double.parseDouble(ch2.getText().toString()) + Double.parseDouble(ch3.getText().toString()) + Double.parseDouble(ch4.getText().toString()) + Double.parseDouble(ch5.getText().toString()) +

How to check that a regular expression has matched a string completely, i.e. - the string did not contain any extra character?

时间秒杀一切 提交于 2019-12-11 07:27:24
问题 I have two questions: 1) I have a regular expression ([A-Z][a-z]{0,2})(\d*) and I am using Python's re.finditer() to match appropriate strings. My problem is, that I want to match only strings that contain no extra characters, otherwise I want to raise an exception. I want to catch a following pattern: - capital letter, followed by 0, 1 or 2 small letters, followed by 0 or more numbers. The pattern represents a chemical formula, i.e. atom followed by number of it's occurences. I want to put

Win Forms Global Exception Handling

浪尽此生 提交于 2019-12-11 07:22:17
问题 i'm trying to do globalexceptionhandling, i've already tried 3 methods to do this but nothing caught an exception thrown somewhere in the program static void Main() { System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Catch); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Catch);

access violation at address in module ntdll.dll - RtlEnterCriticalSection with TCanvas.Lock

自闭症网瘾萝莉.ら 提交于 2019-12-11 07:18:18
问题 I have a random rare AV in my application, which I cannot reproduce unfortunately. exception message : Access violation at address 76FFD968 in module 'ntdll.dll'. Write of address 00000014. main thread ($11a0): 76ffd968 +00099 ntdll.dll 76ffd872 +1b572 ntdll.dll RtlEnterCriticalSection 00470dca +0001e app.exe Graphics TCanvas.Lock 0047116b +0002f app.exe Graphics TCanvas.TryLock 00489cbd +00041 app.exe Controls FreeDeviceContexts 0048ea80 +0003c app.exe Controls TWinControl.MainWndProc

Exception handling in delegate

送分小仙女□ 提交于 2019-12-11 07:00:13
问题 I have the following code which gives me an " Exception was unhandled by user code " when it tries to throw an error: private static void _msgQ_RecieveCompleted(object sender, ReceiveCompletedEventArgs e) { try { //queue that have received a message MessageQueue _mq = (MessageQueue)sender; //get the message off the queue Message _mqmsg = _mq.EndReceive(e.AsyncResult); throw new Exception("This is a test exception by Tim"); //set the values back into a formatted struct //now process your SQL..

C++ - catch all exceptions?

余生长醉 提交于 2019-12-11 06:51:32
问题 I want to inject a DLL into a process. Once this DLL is in there, it should catch & properly handle all access violation exceptions which occur in the process. Is there any way to accomplish this? 回答1: How about SetUnhandledExceptionFilter( function )? function 's prototype is: LONG __stdcall ExceptionHandler(EXCEPTION_POINTERS *ExceptionInfo); I've used this function to create crash dumps, etc. 回答2: You can use Structured Exception Handling (SEH) to catch such exceptions. Specifically, this

Android: requestLocationUpdates throws exception

二次信任 提交于 2019-12-11 06:46:57
问题 I'm trying to get periodically the user position via GPS in Android and send the data to a remote DB, but I get the exception: Can't create handler inside thread that has not called Looper.prepare() . The method that retrieves the position is in a remote service, and it's pretty basic: private void dumpLocationLog() { LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Looper.myLooper().prepare(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L,

How can LLVM use C++'s standard containers without exceptions?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:38:52
问题 According to the LLVM Coding Standards, "LLVM does not use [...] exceptions". However, LLVM does make use of C++'s standard containers, such as std::vector . How is it possible for LLVM to use the standard containers without exceptions? How does it handle a situation in which a container would normally throw ? For example, what happens if std::vector::push_back cannot allocate memory and cannot throw std::bad_alloc ? 回答1: LLVM treats reaching a state which would throw an exception as an

Why is the exception not being caught?

孤人 提交于 2019-12-11 06:33:44
问题 I think there is something missing in my understanding. If I put a breakpoint in the catch where the Console.WriteLine is done, it does not stop. private static void Main(string[] args) { Process(async () => await ClientMethod()).Invoke(); Console.Read(); } public static async Task ClientMethod() { throw new Exception("Test"); } public static Action Process(Action functor) { return () => { try { functor(); } catch (Exception) { // Handle exceptions ? Console.WriteLine("In the catch"); throw;