Questions tagged [exception]

22441 questions
1

votes
2

answer
98

Views

Jmeter - java exception while clicking on response in View Results Tree

I'm facing this issue: Once a test plan has completed, if there are errors, when I click on the red row, I got this exception in the log: 2018-07-18 15:15:03,837 ERROR o.a.j.JMeter: Uncaught exception: java.lang.ClassCastException: java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEve...
ClaudioM
1

votes
2

answer
86

Views

Best Practice: Using Java 8 Optional or throwing Exception

Java 8 has introduced Optional API to denote values which could be null at runtime. In the following cases is it best to throw a checked exception or return a Optional return type to represent edge case? Case 1: Returning type Optional private Optional getItem(String itemName) { for (Item item : ite...
Vino
1

votes
2

answer
53

Views

Reason of not marking Exception as abstract

Microsoft's Best Practice says: Introduce a new exception class only when a predefined one doesn't apply. And: When a custom exception is necessary, name it appropriately and derive it from the Exception class. Deriving from the Exception class makes sense because that makes it possible for us to h...
Hyarus
1

votes
3

answer
57

Views

Handling async exceptions

I'm wondering how I can let this code fall in the catch of PassThrough? using System; using System.Threading.Tasks; public class Program { public static async Task Main(string[] args) { try { await PassThrough(Test()); } catch (Exception) { Console.WriteLine('caught at invocation'); } Console.ReadLi...
grmbl
1

votes
3

answer
45

Views

handing exceptions based on a particular data frame column

I have a data frame as follows: Now I want to divide the x by y values without giving me an exception. For example when I divide 3 by 2 it should give me 1.5 and when I divide 3 by 0 it should give me zero. To achieve this I have written an exception function def divide(x,y): try: result = x/y print...
Omer Qureshi
0

votes
0

answer
7

Views

Improving the relevance of production errors reporting

The support mailbox became unusable : In our mvc application, we catch exceptions thrown at several places (OnException implemented, try/catch in InvokeActionMethod, etc.) and we send a mail for each place (with a log4net appender). This results in an abundance of error mails in the common exchange...
Jean-Luc T.
1

votes
2

answer
189

Views

Intentionally Make the Database to Error

I need to know how to make Oracle database to error out. The reason is to try to catch an exception in the JDBC. Calls to the database are invoked via web services that ultimately use JDBC calls to the database. So, consumers interface to the whole thing through SOAP requests. The majority of reques...
Malvon
1

votes
2

answer
391

Views

How to Convert StackFrame Collection to String?

I have a IEnumerable frames for store some custom StackFrame. I want to convert that to the string type like StackTrace.ToString() format. for example: at TestStackTrace.Form1.button2_Click(Object sender, EventArgs e) in d:\Programming\temp\TestStackTrace\TestStackTrace\Form1.cs:line 66 at System.W...
Behzad
0

votes
0

answer
18

Views

Is relying on GCC's/LLVM's `-fexceptions` technically undefined behavior?

As far as I can tell, compiler extensions may be considered undefined rather than implementation-defined. I am guessing (but do not know for sure) that this applies to the C++ standard as well as C standard. Both GCC and LLVM offer an -fexceptions feature that appears to ensure that throwing an exce...
Kyle Strand
1

votes
2

answer
3.3k

Views

c++ create a class exception

I'm having trouble creating a simple class exception. Basically, I have to throw an exception if my number of score on a golf game is 0, because the method decreases the score by 1. How would I create a simple exception class in this case? My current code looks like this, but I'm stuck, I erased eve...
blayrex
1

votes
2

answer
2.4k

Views

Android MapBox inflating error. Didn't find class MapView

When I launch android app with MapBox library I get exception: 'android.view.InflateException: Binary XML file line #9: Error inflating class com.mapbox.mapboxsdk.views.MapView' Field 'cause' contains this text: java.lang.ClassNotFoundException: Didn't find class 'com.mapbox.mapboxsdk.views.MapView'...
BadEugene
0

votes
1

answer
36

Views

Own Exception with IEnumerable<Exception>

I Want to make my own exception like AggregateException : var exceptions = ErrorCollectionExtension.GetErrorsAsExceptions(compiler.Errors); throw new AggregateException('Error', exceptions); that can take as param List of Exceptions: public MyException(string message, IEnumerable innerExceptions) :...
michasaucer
1

votes
0

answer
15

Views

display exception.ToString in error page ASP Web Forms

in error page ASP Web Form we see some information about error like: Source, Browser, IP, UserID, Error in(page.aspx), Error Message, Stack Trace how to also see exception.ToString in this page?
M.Khooryani
1

votes
1

answer
2.7k

Views

Kafka - Idempotent producer in “exactly once delivery” semantic

From last version of Kafka (0.11.0.0) released the 28th of June 2017, the kafka team provided new features in order to support exactly once delivery. After I downloaded the latest version I tried configuring the Producer (executed through kafka-console-producer.sh script) as described in Producer co...
rh0x
1

votes
2

answer
59

Views

Unhandled exception occurs after handling exception

This theme from my preveus question: How to remove and create log in Windows Event Viewer I created wpf app. I'm catching Unhandled exception with 3 ways: public partial class App : Application { public App() { DispatcherUnhandledException += App_DispatcherUnhandledException; Dispatcher.UnhandledExc...
DIlshod
1

votes
2

answer
25

Views

Exception Helper factory with dynamic description

How do I create ExceptionHelper class that uses string templating to provide dynamic string elements to the caller of the helper? Here is an example of how I currently do it: using System; using System.Collections.Generic; public class Program { public static void Main() { Console.WriteLine('Hello W...
grmihel
1

votes
2

answer
39

Views

How can exception message overtake an executed printed line

I read fields from a .csv file separated with ';' semicolons. And I wrote exeptions to handle the possible deviations. But if there is an exception, the NetBeans read out the error message before the last line. This is how the output look like: I don't understand how is possible that the later line...
Sirsemy
1

votes
3

answer
93

Views

How to call a method that throws an exception in catch block?

I am trying to have an HandleException method that can handles various exceptions. The problem is, my function returns a value. But if I use HandleException in my catch block, Java complains that the function does not return a value even though my HandleException always throw an exception. What is a...
SyncMaster
1

votes
2

answer
47

Views

MSTest ThrowsException with conditions on the exception object?

I'm using MSTest Assert.ThrowsException, but sometimes I want to add test conditions on the thrown exception object, e.g. checking that the message mentions a specific phrase, identifier, data value or whatever. The best solution I've found is a construct that doesn't use Assert.ThrowsException, but...
Kjell Rilbe
1

votes
3

answer
49

Views

What is a exception error and how do I fix it?

I am extremely new to Java and need your help. I was given the class MD5Digest by my instructor, and when I run the file by itself, it compiles without an issue. But when I copy and paste the class over to my file, it doesn't work. Can someone please help me? I read that it has something to do w...
GarbageCoder
1

votes
4

answer
37

Views

How to know if exception is built-in or user-defined in Python

I have my own exception classes inheriting from Exception class. I could check if type is in {..my exceptions list..}, but that seems problematic in my case. Is there any other way of checking if the exception is user-defined or Python's built-in exception. Thank you! EDIT: The problem is that other...
Sargsyan Grigor
1

votes
1

answer
46

Views

Lambda return method which calls method that throws exception

I have following issue. I'm working within a method 1 and this method 1 should return an object of a certain class. For my return statement I call another method 2 (which of course returns an object of said class). Though this other method 2 throws an exception. How should I write my return statemen...
SimonartM
1

votes
2

answer
57

Views

object of class without parameterless constructor in automated storage and exceptions

I have a factory method that returns object of a class type. MyClass factory(string param1, ...) { ... MyClass instance(param1); ... if (smth) throw ...; ... return instance; } The factory method may throw. I'm trying to create an object of this class with exception handling. Something like this: My...
Alex Netkachov
1

votes
1

answer
42

Views

Writing an exception helper method

I'm new to C# and was practicing throwing Exceptions. Is it good practice to throw an exception from a helper method to shorten the amount of code needed? Like so: public static void ThrowExcIfNull(this T[] array) { if (array == null) throw new ArgumentNullException('Array is null'); } /// /// Does...
MP1
1

votes
3

answer
572

Views

Exception polymorphism c++

I have made my own exception class which derives from runtime_error and is getting an int in the c'tor. I would like to make a base class for this exception, in order to use polymorphism, so I could catch only the base class and basically I would be catching the derived class. So, this is the base c...
Jjang
1

votes
3

answer
1.8k

Views

Statements within catch block is not executing

I wrote a piece of code to catch specific exception with help from this link. It is like: catch (SQLException sqle) { // TODO Auto-generated catch block String sqlMessage = sqle.getMessage(); String sqlState = sqle.getSQLState(); int vendorCode = sqle.getErrorCode(); System.out.println('Exception oc...
Mistu4u
1

votes
1

answer
39

Views

Why groovy method doesn't print that file doesn't exist?

I have problem with my groovy script. I'm reading content from registerFile and I want to catch Exception when file is not found. Nevertheless below function doesn't throw exception even if registerfile does not exist, why? Fragment of my code: def registerFile static void main(def args) { Agent ag...
Rafal Iwaniak
1

votes
0

answer
64

Views

Clang exception capturing not working correctly

I'm using the clang x64 compiler on MacOS 10.12. I have the following code: try { throw CryptoPP::Exception(CryptoPP::Exception::OTHER_ERROR, 'test'); } catch(CryptoPP::Exception &e) { std::cout
Felix
1

votes
1

answer
47

Views

Pydoc Uncaught Exception

I looked up sys in pydoc because a book I am reading recommended it to me, I came across last_type which was type of last uncaught exception, my question is what is an uncaught exception in pydoc/python and what is it used for?
Popam
1

votes
1

answer
169

Views

Interrupted downloads when downloading a file from Web Api (remote host closed error 0x800704CD)

I have read near 20 other posts about this particular error, but most seem to be issues with the code calling Response.Close or similar, which is not our case. I understand that this particular error means that typically a user browsed away from the web page or cancelled the request midway, but in o...
David Anderson
1

votes
0

answer
27

Views

How to set a exception in a xpath filter for a similar sounding word?

I'm trying to import a large .csv file (60k entries) in one of my projects by using an importer tool. This tool allows me to filter the entries with the help of a xpath command, which is very useful, because I only need a few of these entries actually. So I'm trying to filter the [title] element by...
B4rT
1

votes
0

answer
63

Views

Python uncaught exception

I've got two programs written in Python2 running on Raspberry Pi, but my question strictly concerns Python. First program detects temperature and prints its value on a 16x2 LCD, while the second one is controlled by an IR remote which is used for toggling LEDs. Both programs use similar try/except m...
dominikbrandon
1

votes
1

answer
687

Views

Globally handle all exceptions in WebAPI 2 [closed]

I am working in WebApi2. I am going to implement global exception handling. As all we knew, we can use IExceptionHandler and IExceptionLogger for the same. I also implemented the same and working fine. But i am little bit confused with some more scenarios. So I split all my scenarios into 3 parts 1....
Akhil
1

votes
1

answer
777

Views

how to handle close connection Exception in websockets and asyncio (Python)?

I am using websockets and asyncio in Python 3.6.3 on windows cygwin. This is my code: It was slightly simplified for reading. It run and outputed correctly for a while, but later nothing was printed. I pressed ctrl+C, and got this on exiting: Exception ignored in: RuntimeError: generator ignored G...
user861746
1

votes
1

answer
48

Views

How to iterate over all error_info's in boost::exception?

At the catch site of a boost::exception (or std::exception), I want to iterate over all error_info elements of the exception, without knowing the types. I need to extract all the name-value pairs. I guess it should possible since the boost::diagnostic_information function does that, but I'd like to...
Pat
1

votes
1

answer
291

Views

MediaSession finishBroadcast() exception

any idea about the cause of this exception? 01-10 15:33:43.111 21717-21717/com.music.ofek.iplay E/AndroidRuntime: FATAL EXCEPTION: main Process: com.music.ofek.iplay, PID: 21717 java.lang.IllegalStateException: finishBroadcast() called outside of a broadcast at android.os.RemoteCallbackList.finishBr...
Ofek Regev
1

votes
0

answer
272

Views

“HttpMediaTypeNotAcceptableException: Could not find acceptable representation” error with type HTML

I have a simple controller: @RequestMapping(value = '/html', method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity calculateHTML(@RequestParam(required = false) final String key){ String asd = 'Hello World!'; HttpHeaders headers = new HttpHeaders(); headers.setConte...
Colanta
1

votes
2

answer
50

Views

Use of generics in Exceptions

So my question will sound like a discussion but it's not. I'm looking for sources on the topic but I can't seem to find many. Here I go, in .Net, it is possible to create a generic exception and catch it, ie. class MyException : Exception { } // ... catch(MyException e) { } But I notice that I can't...
Foxtrot Romeo
1

votes
0

answer
143

Views

JDBC treat warnings as error on data truncation

I have a MySQL table with three fields: fname varchar(20) ftype varchar(10) value varchar(30) as you can see 'value' is a varchar, but I use it to store differente kind of value (entered by users), so I can do: UPDATE table SET value = 1 + value WHERE ftype='COUNTER'; it works as intended,...
moretti.fabio
1

votes
3

answer
404

Views

How to avoid StaleElementReferenceException in Selenium?

I looked everywhere and saw many solutions but unfortunately in my case, it's not a matter of waiting for the visibility of elements. Basically I am analyzing a webpage where the contents are updated at certain internals, so the numbers of the webpage changes. But the number of elements I am queryin...
Joan Venge

View additional questions