exception-handling

What purpose does the complexity of `Except` serve in Haskell?

巧了我就是萌 提交于 2020-01-02 04:56:31
问题 I understand (I think) that there is a close relationship between Either and Except in Haskell, and that it is easy to convert from one to the other. But I'm a bit confused about best practices for handling errors in Haskell and under what circumstances and scenarios I would choose one over the other. For example, in the example provided in Control.Monad.Except , Either is used in the definition type LengthMonad = Either LengthError so that calculateLength "abc" is Right 3 If instead one were

C++: Is using segvcatch safe?

自作多情 提交于 2020-01-02 04:29:47
问题 I just stumbled upon the segvcatch library which promises to wrap segfaults and floating point errors into appropriate exceptions. Is using this library safe, if I add the precondition that all segfaults caught will only be null pointer accesses (i.e., no array overflows or invalid pointers which could have screwed up the memory completely before segfaulting, resulting in undefined behaviour anyway)? Will the program still have defined semantics after catching a nullptr segfault? What about

Silent exception,

冷暖自知 提交于 2020-01-02 03:43:07
问题 I've encountered this weird issue of silent exceptions in 64 bit. What is that cause this bahavior? I would like to understand why does this occur and what is the recommended solution? disappearing OnLoad exception microsoft - silent exception KB976038 on the main: try { Application.Run(new Form1()); } catch (Exception ex) { MessageBox.Show("Error"); } private void Form1_Load(object sender, EventArgs e) { throw new Exception("oh no!"); } 回答1: In order to load a form, your code will call into

How do you handle an exception with ASP.net MVC's AsyncController?

吃可爱长大的小学妹 提交于 2020-01-02 03:13:53
问题 I've got this... public void FooAsync() { AsyncManager.OutstandingOperations.Increment(); Task.Factory.StartNew(() => { try { doSomething.Start(); } catch (Exception e) { AsyncManager.Parameters["exc"] = e; } finally { AsyncManager.OutstandingOperations.Decrement(); } }); } public ActionResult FooCompleted(Exception exc) { if (exc != null) { throw exc; } return View(); } Is there a better way of passing an exception back to ASP.net? Cheers, Ian. 回答1: Task will catch the exceptions for you. If

terminate called recursively

南楼画角 提交于 2020-01-02 02:54:06
问题 As far as I know, terminate() is called when there is some problem with exception handling(usually it's just not caught). What I got is just one error line terminate called recursively . After googling for some time I found a lot of examples of terminate called after throwing an instance of ... terminate called recursively But it's not my case. As I don't have this hint about the exception type, I'm wondering what does this terminate called recursively mean by itself. Sorry I can't provide

Unhandled exceptions in Google Apps Script

微笑、不失礼 提交于 2020-01-02 02:40:48
问题 I have created a public Web App with access to my private spreadsheet data. I can catch and log exceptions in try..catch , but: is it possible to catch all unhandled exceptions, like browsers window.onerror ? can I view logs of unhandled exceptions somewhere? by exceptions like "Service invoked too many times" my app is even not getting run, so here I definitely can`t handle the exceptions. Is there logs with such kind of exceptions? These are so simple questions, so that I'm bit confused to

Why should I use exception handling in php?

大憨熊 提交于 2020-01-02 02:33:57
问题 I've been programming PHP for a long time, but not so much PHP 5... I've known about exception handling in PHP 5 for some time, but never really looked into it. After a quick Google it seems fairly pointless to use exception handling - I can't see the advantages of using it over just using some if() {} statements, and perhaps my own error handling class or whatever. There's got to be a bunch of good reasons for using it (I guess?!) otherwise it wouldn't have been put into the language

Django - catch exception

非 Y 不嫁゛ 提交于 2020-01-02 02:20:10
问题 It might be a Python newbie question... try: #do something except: raise Exception('XYZ has gone wrong...') Even with DEBUG=True, I don't want this raise Exception gives me that yellow page. I actually want to handle the exception by redirecting users to an error page or shows the error (give a CSS error message on the top of the page...) How do I handle that? Can someone guide me? If I simply raise it, I will get yellow debug page (again, I don't want certain exceptions to stop the site from

PHP try catch exceptions

主宰稳场 提交于 2020-01-02 02:01:07
问题 Hello I have a code like that : try { // Here I call my external function do_some_work() } catch(Exception $e){} The question is: If the do_some_work() has a problem and produce an Error this try catch will hide the error? 回答1: There are two types of error in PHP. There are exceptions, and there are errors. try..catch will handle exceptions, but it will not handle errors. In order to catch PHP errors, you need to use the set_error_handler() function. One way to simplify things mught be to get

JAX-WS Soap Faults not appearing in WSDL

我们两清 提交于 2020-01-02 01:25:14
问题 I am creating a web service using JAX-WS (I am creating this using the Java to WSDL approach). Im having trouble getting my exception to work as I require. I have created the following exception class: @WebFault public class MyWebServiceException extends SOAPFaultException { private static final long serialVersionUID = 8234753208722614057L; protected MyWebServiceException(SOAPFault fault) { super(fault); } protected MyWebServiceException(SOAPFault fault, Throwable throwable) { this(fault);