exception-handling

SQL procedure returning too many rows

蓝咒 提交于 2019-12-25 18:47:19
问题 I've created a procedure that takes pid as parameter and returns monthly sale stats of that pid , it uses two tables, products and purchases where pid in purchases is foreign key referencing pid in products. The procedure builds without errors and executes well for only single row returns and otherwise give too_many_rows exception My procedure is as follows: set serveroutput on create or replace procedure try( p_pid in purchases.pid%type) is p_pname products.pname%type; p_date varchar2(10); p

Handle a exception that happens in a asynchronous method in C#

纵饮孤独 提交于 2019-12-25 18:17:51
问题 From now I'm a beginner in Async coding, I just can't see what I could do in this example. I have two projects, one have the classes to communicate to a certain service, and the another one is the WinForms project. So I have a reference in the WinForms from the other project that allows me to create instances of the Client object to use it like I want. The problem is, because of that, I can't use System.Windows.Forms.MessageBox. Then, I'd use the try...catch in the Form class, but... The

Extract data from JSON from an API with Python

╄→尐↘猪︶ㄣ 提交于 2019-12-25 17:50:36
问题 The data under consideration is coming from an API, which means that it's highly inconsistent- sometimes it pulls unexpected content, sometimes it pulls nothing, etc. What I'm interested in is the data associated with ISO 3166-2 for each record. The data (when it doesn't encounter an error) generally looks something like this: {"countryCode": "GB", "adminCode1": "ENG", "countryName": "United Kingdom", "distance": 0, "codes": [{"type": "ISO3166-2", "code": "ENG"}], "adminName1": "England"} {

How does Google Cloud Endpoints map API responses to HTTP Codes?

梦想与她 提交于 2019-12-25 16:42:33
问题 I am using Google Cloud Endpoint for Python. I have an endpoint that throws an Exception in certain cases. According to the documentation, throwing a custom Exception that inherits from endpoints.ServiceException should cause all HTTP status codes from 400-413 to be preserved in the HTTP response. However, my tests show that error code 404 is preserved while 408 and 409 are mapped to a 400. Am I misunderstanding the documentation? Here is my custom Exception class and the 3 different HTTP

How can I continue execution of a catch block when the user enters credentials, from an exception caused by a credentials popup appears?

a 夏天 提交于 2019-12-25 14:13:41
问题 I made a Winforms application, which acccesses folders on another server (in another active directory domain). The line of gets all directories from a folder, but it may sometimes fail with an exception because the credentials to access the folder (basic authentication) have not been saved, so the basic auth dialog box pops up again and again, breaking the system. In the corresponding catch block, how could I handle this by resuming execution of the catch block after the user enters his or

Exception is not caught - AggregateException unhandled

房东的猫 提交于 2019-12-25 09:19:08
问题 Do anyone know why the following code does not catch my ConnectionException, I've spend hours with it... public async Task LoadContacts(string filter) { // We will send find contacts message to all servers supporting addressbook. var addressBookServers = _addressBookService.GetAddressBookServerList(); // Create task array here to be able to run each task in parallel manner. var tasksToProcess = new List<Task<SearchContactsResultDto>>(addressBookServers.Count); for (int i = 0; i <

What is the best & easiest way for Exception Handling via AJAX in MVC?

别来无恙 提交于 2019-12-25 07:59:41
问题 I have an MVC5 project and need to handle exceptions by using a custom method that can be used for all of the Controller or Action methods. For solving the problem I have found some example as posted on Exception handling in ASP.NET MVC and tried to use follow an approach as shown below: Custom Attribute: public class MyErrorHandlerAttribute : FilterAttribute, IExceptionFilter { public void OnException(ExceptionContext filterContext) { filterContext.ExceptionHandled = true; filterContext

How to manage pool thread termination in ThreadPoolExecutor?

北战南征 提交于 2019-12-25 07:50:40
问题 Quote from concurrency in practice: To set an UncaughtExceptionHandler for pool threads, provide a ThreadFactory to the ThreadPoolExecutor constructor. (As with all thread manipulation, only the thread's owner should change its UncaughtExceptionHandler.) The standard thread pools allow an uncaught task exception to terminate the pool thread, but use a try-finally block to be notified when this happens so the thread can be replaced. Without an uncaught exception handler or other failure

How to continue while loop after exception raised in SQL

岁酱吖の 提交于 2019-12-25 07:31:05
问题 How would I continue the while loop after an exception has been raised in the code below? DECLARE v_blob_data BLOB; v_blob_len NUMBER; v_position NUMBER; v_raw_chunk RAW(10000); v_char CHAR(1); c_chunk_len number := 1; v_line VARCHAR2 (32767) := NULL; v_data_array wwv_flow_global.vc_arr2; v_rows number; v_sr_no number := 1; v_first_line_done boolean := false; v_error_cd number :=0; v_quote_pos1 NUMBER; v_quote_pos2 NUMBER; v_enclosed_str VARCHAR(200); v_errmsg VARCHAR2(4000); BEGIN delete

Specific Exceptions vs Exception

天大地大妈咪最大 提交于 2019-12-25 06:57:59
问题 This may be a very dumb question, but I'm trying to understand why it is significant. Why is it important to use a specific exception instead of just using Exception. Here is an example: List<String> testList = new ArrayList<String>(); try { testList.add(1, "String"); } catch (IndexOutOfBoundsException ex) { ex.printStackTrace(); } The above example has the specific exception this would raise. Why is it important to have IndexOutOFBoundsException instead of just using Exception . I know using