exception

PostgreSQL custom exception conditions

旧巷老猫 提交于 2020-07-08 04:32:09
问题 Is it possible to create custom conditions when I raise an exception? Consider the following example: BEGIN y := x / 0; EXCEPTION WHEN division_by_zero THEN RAISE NOTICE 'caught division_by_zero'; RETURN x; END; Here I use 'division_by_zero' condition to catch the exception. What I'd like to do is something like this: BEGIN [...] RAISE custom_condition; EXCEPTION WHEN custom_condition THEN [...] END; so that I don't interfere with possible standard exceptions. I could just do y:= 1 / 0; and

HttpClient - PostAsync doesn’t return

三世轮回 提交于 2020-07-08 00:35:35
问题 Does anyone know why HttpClient - PostAsync doesn’t return. It just does nothing. I have had it working occasionally especially for one off posts but it seems sometimes to not do anything especially under load and it doesn't throw an exception which of course makes my code unreliable and hard to debug. I have tried adding ConfigureAwait(false) It makes not difference. I suspect the Task is failing to 'pack' This is in a core 3.0 console app run on macOS Catalina using visual studio code This

Windows Forms Unhandled-Exception Dialog

自闭症网瘾萝莉.ら 提交于 2020-07-05 03:41:05
问题 I want to get Default Windows Forms Unhandled-Exception Dialog whenever my C# application encounters U-E. In vs 2005 when I turn off jit Debugging in app.conf like this: <configuration> <system.windows.forms jitDebugging="false" /> <configuration> the application behaves correctly and shows Windows Forms U-E default dialog, with Continue, Quit, call stack and all. However in vs 2008, on the same machine or different, even though I diable jit I still get Default .NET Unhandled-Exception Dialog

How to catch “org.springframework.web.multipart.MultipartException” in Grails 3

大兔子大兔子 提交于 2020-06-29 09:14:10
问题 I'm having an awfully hard time catching the error: org.springframework.web.multipart.MultipartException I have the following code: final class UploadTextCommand { MultipartFile contents static constraints = { } } Additionally to handle the post of the file I have this action: def upload = { UploadTextCommand -> ...code... } I've got these settings in the "application.yml" file to force the error: controllers: upload: maxFileSize: 100 maxRequestSize: 100 So I can reliably recreate the

How to not break when user handled exception is thrown in visual studio 2019

自闭症网瘾萝莉.ら 提交于 2020-06-29 04:05:40
问题 Microsoft Visual Studio Enterprise 2019 Version 16.5.5 VisualStudio.16.Release/16.5.5+30104.148 Microsoft .NET Framework Version 4.8.03752 I don't want visual studio to break in debug mode when such as below exceptions happened. The ones that i have handled via try catch. But i could not find a way even though I did extensive internet search project details : asp.net web forms, .net 4.8 framework 回答1: You should be able to uncheck the checkbox next to "Break when this exception type is thrown

How to not break when user handled exception is thrown in visual studio 2019

牧云@^-^@ 提交于 2020-06-29 04:05:14
问题 Microsoft Visual Studio Enterprise 2019 Version 16.5.5 VisualStudio.16.Release/16.5.5+30104.148 Microsoft .NET Framework Version 4.8.03752 I don't want visual studio to break in debug mode when such as below exceptions happened. The ones that i have handled via try catch. But i could not find a way even though I did extensive internet search project details : asp.net web forms, .net 4.8 framework 回答1: You should be able to uncheck the checkbox next to "Break when this exception type is thrown

Hibernate - during an exception log sql and all parameters

最后都变了- 提交于 2020-06-29 03:49:17
问题 The bounty expires in 3 days . Answers to this question are eligible for a +300 reputation bounty. bharal wants to draw more attention to this question. How do I get hibernate to fully log all details when an exception is thrown? I would like to see the full (not truncated) sql and the full (not truncated) parameters. ie Hibernate is throwing: Caused by: org.hibernate.exception.DataException: could not execute statement long stack trace Caused by: java.sql.SQLDataException: Incorrect string

PHP (or other): Strategy to deal with exceptions that “cannot occur”

你说的曾经没有我的故事 提交于 2020-06-28 10:56:48
问题 Consider the following code. class C {} /** * @throws \InvalidArgumentException */ function classCreateInstance($class) { if (!is_string($class)) { throw new \InvalidArgumentException("Class name must be a string."); } if (!class_exists($class)) { throw new \InvalidArgumentException("Class '$class' does not exist."); } return new $class(); } /** * @return C */ function foo() { return classCreateInstance(C::class); } There is one function that may throw an exception, because it does not know

PHP (or other): Strategy to deal with exceptions that “cannot occur”

随声附和 提交于 2020-06-28 10:56:06
问题 Consider the following code. class C {} /** * @throws \InvalidArgumentException */ function classCreateInstance($class) { if (!is_string($class)) { throw new \InvalidArgumentException("Class name must be a string."); } if (!class_exists($class)) { throw new \InvalidArgumentException("Class '$class' does not exist."); } return new $class(); } /** * @return C */ function foo() { return classCreateInstance(C::class); } There is one function that may throw an exception, because it does not know

Exceptions must derive from BaseException

非 Y 不嫁゛ 提交于 2020-06-28 03:42:36
问题 What am I missing here? import sys class MyBaseError(BaseException): def __init__(self, message, base_message=None, *args): self.message = message self.base_message = base_message super(MyBaseError, self).__init__() def __str__(self): if self.base_message is None: return self.message return self.message + " '" + str(self.base_message) + "'" class MyError(MyBaseError): """ """ class MyTypeError(MyError): """ """ def run_me(): raise MyTypeError("run_me") def sayonara(): try: run_me() except