Questions tagged [exception-handling]

Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution.

2
votes
0answers
16 views

Java 8 - throw multiple generic checked exceptions in lambda

In a project I am working at, I have found a class which wraps all methods of its super-class in some elaborate exception handling. It looks similar to that: public void method1() throws ExceptionA { ...
0
votes
0answers
5 views

EasyModbus: disconnecting from network doesn't change the connection state

In a C# application I use EasyModbus to connect to a remote server: ModbusClient client = new ModbusClient() { IPAddress = "192.168.1.100", Port = 502, ConnectionTimeout = 200 } try { ...
1
vote
0answers
14 views

Correct way to catch a specific exception when wrapped in a PSInvalidCastException

Given the following invalid XML: <?xml version="1.0" encoding="utf-8"?> <root><nodeNotClosed></root> This PowerShell will capture the invalid cast exception: $path = 'c:\...
0
votes
2answers
25 views

Exception not caught after signal

I try to catch a termination signal to my code to write a restart file before exiting. My solution is based on this answer. #include <exception> #include <csignal> #include <iostream&...
0
votes
1answer
54 views

application does not appear to be catching an exception

I have a c# console application. I also have windows task scheduler which I use to execute my exe file every morning. I put a try catch block (shown below) to capture any errors and write the ...
-1
votes
2answers
35 views

Python Exception not Raised

I am working with a python gui application which I forked, modified, and am now debugging (for a custom game controller, if you must know). The application launches a subprocess to handle ...
0
votes
0answers
28 views

Kafka Streams Shutdown Hook and Unexpected Exception Handling in the same Stream application

I was tasked with tearing down a Dev environment and setting it up again from scrap to verify our CI-CD processes; only problem was that I messed up creating one topic and so the Kafka Streams ...
0
votes
0answers
31 views

Java ERROR: “java.lang.StringIndexOutOfBoundsException: String index out of range: 0” for do-while loop [duplicate]

So I've tried looking through other threads with similar problems, but I couldn't really relate them to my current problem as most of them were suggesting solutions that I haven't been currently ...
0
votes
0answers
23 views

Design Pattern for Handling Camel Exceptions?

I am trying to determine the best way to cleanly handle exceptions that happen during my message processing pipeline. From the Camel in Action (2nd Edition Book) on page 500 you can implement the ...
0
votes
2answers
29 views

try-catch statement interrupt try-block as soon as exception is thrown

Research: According to MDN web docs : The try...catch statement marks a block of statements to try, and specifies a response, should an exception be thrown. If I understand this correctly the ...
0
votes
1answer
36 views

Python 'try - except - else' handling multiple possible outcomes simultaneously

I have a function that fits to a 1D array of data, but this function can fail if the data is inappropriate and will raise a RuntimeError. As my data is a 2D array I want to try it on both axis of the ...
3
votes
1answer
51 views

Laravel email notification upon all exceptions

I am developing a project and i would like to have a notification system especially for the "first days of live" - to receive an email everytime an exception is thrown . I've read that article and ...
1
vote
1answer
36 views

UncaughtExceptionHandler not called

I am having trouble using the UncaughtExceptionHandler in Groovy/Java. class UncaughtExceptionLogger implements Thread.UncaughtExceptionHandler { @Override void uncaughtException(Thread t, ...
2
votes
0answers
18 views

Exception handling – final routine for the whole script

Another Python question. I'm familiar with the try – except – finally concept. What I would like to know: is it possible to call some final clean-up routine when the program raises an error, no ...
1
vote
2answers
33 views

how to “get” an exception context for error handling?

I have a script that runs great but i am considering enhancing it by adding more exception handling that i received in the past in case future users struggle and need a clear hint at the possible ...
0
votes
0answers
18 views

Iterated MapReduce job has NumberFormatException error

My program runs multiple Map reduce jobs, one for every line of parameters in the parameters file that I am passing to it. The main function is as follows: public static void main(String[] args) ...
0
votes
1answer
27 views

JAX-RS exception mapper: What about wrapped exceptions and default case?

A typical way to deal with exceptions in REST service is to define custom exception types (typically from RuntimeException) and then implement a mapper class to produce HTTP codes, for example: ...
0
votes
1answer
65 views

Reload app even after app crash in ios like android

In Android, there is a method Thread.setDefaultUncaughtExceptionHandler(); When crashed it could be called and make a function to land the app on the home page. Is there any similar methods in ios ...
0
votes
1answer
24 views

How to catch the original Exception, when using WebServices?

After searching for days now and reading pretty much everything related to that, I'm finally posting my question here, since I couldn't find a solution for my specific problem. I want my REST ...
0
votes
2answers
21 views

How to send a handled exception to HockeyApp SDK in XAMARIN android app?

Hi guys is this possible to send a handled exception to HockeyApp SDK using Xamarin android ? I am getting unhandled exceptions in HockeyApp SDK . Can any one suggest some way to this problem. the ...
0
votes
0answers
13 views

Apache Tika Exception handling

here is my code which is used to extract content and metadata, unfortunately this code runs into issue only when i pass a '.docx' document for parsing - while i'm figuring out how to fix that , can ...
1
vote
1answer
24 views

Spring Boot: disable security for status exception code

I have a Spring Boot application, with security. And I have removed the authentication for this "/login" url. My Security Configuration @Configuration public class SecurityConfiguration extends ...
0
votes
2answers
39 views

RetryWhen and exception logic

I have been looking at implementing a basic retry logic for a simple network stream. The idea is that there are three types of exceptions to handle: Transient exceptions, should reconnect and retry ...
1
vote
1answer
23 views

Catch AuthenticationException in Python Paramiko

import paramiko host='x.x.x.x' port=22 username='root' password='password' cmd='dmidecode > a' ssh=paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(...
2
votes
2answers
50 views

Spring @Transactional method Error handling

I am using a Transactional method using @Transactional annotation. I am trying to save an object to the database using JpaRepository's save() method. (which will throw an error due to constraints on ...
0
votes
2answers
26 views

InputMismatchException crashes program after being caught

Introduction I am having a problem catching an InputMismatchException. I have read all of the threads on this site that appear on the first page when I search for InputMismatchException already. I ...
1
vote
0answers
21 views

Understanding `traceback.format_exception_only()`

I wanted to just print exception type and message. I initially tried: try: raise Exception("duh!!!") except Exception as err: print(err) But this only printed exception message. duh!!! ...
2
votes
3answers
103 views

What is the best way to deal with exception in step 1 when step 2 is must to execute

In our application situation is, user has requested to update 2 fields say (A, B) for an account. An account has multiple stores to which updated fields to be pushed. One of the store is marked as ...
3
votes
1answer
48 views

What specific exceptions represent a serialization failure when Django is using serializable transaction isolation level with postgresql?

Sometimes it's desirable to use a higher isolation level than the default "read committed" for database operations in Django. The docs warn that: Under higher isolation levels, your application ...
-1
votes
0answers
32 views

Is it acceptable to have unchecked exceptions declared in the throws clause?

In our internal API I'm frequently seeing throws clause being used for custom unchecked exceptions. Going through Effective Java (Edition-2) Item 58, 59 and reading some other posts - Should I ...
0
votes
2answers
28 views

Spring boot Exception custom handling - Unexpected HTTP status

I am trying to implement some custom exception handlers in my spring boot application which will be able to handle custom exceptions and display appropiate message and status code. My issue : ...
1
vote
0answers
15 views

Android Espresso : correctly test closing app with pressBack

I'm trying to implement some navigation tests with espresso. Actually i want to check if the application has been closed by the use of the Back key on the main screen, just after a fresh start. Here ...
1
vote
2answers
80 views

Exception handling using ArrayList with java

I Started working on java a few months back now I am stuck in exception handling what I need is, that every StudentId, TeamID must go throw one round of exception check so that if the user enters ...
0
votes
0answers
11 views

Error while inserting in a table containing identity column System.Data.Entity.Infrastructure.DbUpdateException

In my ASP.Net MVC 4 project I'm trying to insert data into a table which has identity an auto-increment column (ACTIVITYID), which is the Primary Key. Table Class public partial class ACTIVITY { ...
0
votes
2answers
33 views

php exception handling issue

I am simply trying to put a arithmetic expression around try-catch block. Here's what I tried: try { $result = 4/0; } catch (Exception $e) { d($e->getMessage(...
3
votes
1answer
41 views

How to return/throw ServiceStack's HttpError using scoped JsConfig?

I have multiple API versions that uses the same AppHost, which is why I don't want to modify the static JsConfig--I only want the HttpError response to be serialized using a scoped JsConfig. I tried ...
2
votes
2answers
31 views

Assert that element cannot respond to mouseover

I am trying to assert that, when I mouseover a covered element, the element on top is activated and not the hidden one. However, when using .trigger('mouseover') on the hidden object, an error occurs ...
1
vote
1answer
31 views

Spring-webflux, how to get the request as parameter in @ExceptionHandler

With spring webflux and the @RestController model, I have a @RestControllerAdvice with some @ExceptionHandler methods. I would like to get the original request as parameter because I want to log it ...
2
votes
2answers
45 views

Is it good practice to have Generic Exception class handler in global exception handler with spring rest?

I was referring few articles to create global exception handler using @ControllerAdvice for my rest api project using spring. The purpose of this is to send proper formatted response to the client in ...
0
votes
1answer
20 views

Retrieve single user data from oracle database into visual studio C# application

I am using forms in visual studio to create an application and then retrieve data from Oracle database. My all parts are working except getting data for the single user. Here is form.cs section for ...
0
votes
2answers
42 views

Trying to prompt the user to re-enter from the catch block, but the catch block terminates?

I am trying to write a program to ask a user to enter their age and prompt them to re-enter if they enter an improper value (such as a negative number, older than 120, an age with special characters ...
0
votes
0answers
31 views

How to manually handle JsonMappingException instead of letting the container handle it

We have several Spring Boot applications that provide REST services that expect JSON messages. We have both "JsonParseExceptionMapper" and "JsonMappingExceptionMapper" registered in our Jersey ...
0
votes
2answers
48 views

How to handle exception thrown by object in @Requestbody in spring boot 2

I have a rest controller class as follows which throws custom exception when user object is invalid. But those exception got wrapped by spring framework and not handled by the specific exception ...
1
vote
0answers
32 views

making errors more generic in october cms

I am new to coding. I am trying to create a project in october cms. My question is regarding the error handling. The errors seem to be too informative, and telling about the file name. For example ...
0
votes
1answer
32 views

Braces preventing Compilation

Im currently creating a GUI from scratch and I am including multiple classes on one page. Unfortunately, something is preventing me from seeing a class and I think it has to do with opening and ...
0
votes
0answers
19 views

python exception handling in different packages

I have 3 packages pckg1/exception.py . class BaseError(Exception): .. class MyError(BaseError): .. pckg2/f1.py from pckg1.exceptions import Myerror def function(): if (condition): ...
-1
votes
1answer
19 views

Exception handling with user input when several inputs in a row is required

I am working on a program where the user can add persons as well as vehicles. The program is functioning to the requirements of the scholl assignment, however I want it to work even better by handling ...
0
votes
0answers
17 views

Retrieve stack frame from MException

I try to write a wrapper in matlab which creates as a dump in case of script exceptions. Eg: If a script fails write a dump file with a stack trace including workspaces of each stack frame. However ...
2
votes
1answer
48 views

Two exceptions “at the same time”, what is the proper way to handle this situation?

I have a situation where I need to call to foo method, if it fails call bar method, then re-throw the original exception (wrapped). My problem is that bar method could fail too, and its exception ...
0
votes
0answers
24 views

Python 3 : Raising exceptions within excpetions

Is the code below a bad practice? It works the way I want it, but couldn't find any other examples where an exception is raised within another exception. If it is a bad practice, what would be the ...