Most voted "exception" questions
The exception treatment is the mechanism responsible for the processing of occurrence of conditions that change the normal flow of code execution.
Learn more…329 questions
Sort by count of
-
4
votes1
answer102
viewsExceptions.py file
I program in python about a year ago, and I’ve always seen in some projects that I see on the web, an archive called exceptions.py. I can handle exceptions within my codes, this is not my doubt. I…
-
4
votes1
answer551
viewsIteration gives Concurrentmodificationexception error by including more than one button
I have this little game that I’m developing where the character goes through buttons that will remove barriers so that it can access other areas of the maze. I created two lists, one for the fences…
-
4
votes2
answers360
viewsPut method return before a "Finally" block
Considering: try { System.out.println("Parte 1"); return false; } finally { System.out.println("Parte 2"); } What will be the output and what happens behind the scenes so that the output come out…
-
4
votes1
answer423
viewsTry/catch does not "catch" to Exception
I’m using JPA and was trying to create an Entitymanager, and was testing some expcetions treatments in a class of mine. However, I have a problem, that Exception is not being "caught" by catch.…
-
4
votes1
answer57092
viewsHow to resolve java.lang.Nullpointerexception?
I created the class Server! However an Exception of the type is launched java.lang.NullPointerException! I wonder if someone could help me with this problem? The class is as follows: public class…
-
4
votes2
answers232
viewsPower method and exception treatment
I must resolve the following exercise but I have some doubts: Create a class with only one method power, which receives 2 numbers and calculates the number 1 to the number 2. This process must…
-
4
votes1
answer256
viewsWhat is the difference between "Exception.Message" and "Exception.Tostring()"?
I’ve read some answers regarding try-catch and on the Exceptionbut I still have doubt about the difference in Exception.Message and Exception.ToString(): What’s the difference between one and the…
-
4
votes1
answer1001
viewsEnd a process without closing the executable
I’m developing an integrated system with a TEF. Every time a credit card transaction is performed the TEF creates a file with a specified name in a specific directory, my application reads this file…
-
4
votes2
answers884
viewsWhat to write in an Exception Class (Exception)?
I was looking at that question at Stackoverflow en How can I write custom Exceptions? and the most well-voted (and accepted) response was: public class MyNewException extends RuntimeException {…
exceptionasked 9 years, 4 months ago KaduAmaral 11,472 -
4
votes2
answers2086
viewsHow to capture all exceptions in Python?
How to capture any and all Python exceptions? Are there any keywords for this? Like in Java you just make one try { } catch(Exception ex) { }
-
4
votes1
answer4336
viewsException when it will generate bank bill with Boleto.Net
I have a system that generates Santander billets using a specific DLL that was downloaded from the internet. The name is "Boleto.net". I need to create a Bradesco ticket. I changed where I passed…
-
4
votes1
answer386
viewsHow to Encrypt Images with Java RC5 Algorithm
I am trying to use the RC5 algorithm with the Cipher class of Java, but it is returning an error, someone can help me? import java.io.*; import java.security.*; import javax.crypto.*; public class…
-
4
votes2
answers767
viewsHow to treat exception that cannot delete as it is a Foreign key
I am not able to treat an exception that happens when I delete an address that is being used in another table. I’m using the codeigniter my code is: public function…
-
4
votes1
answer483
viewsWhen and where to handle exceptions with Laravel in developing an API
I’m having some doubts when it comes to handling errors in an API. We should always treat an Exception? It would be correct to return a message like the one below? Return: { "success" : false,…
-
4
votes1
answer308
viewsHow to cast exception in SQL and treat in C#
I’m creating procedures in an SQL Server database. To clear a brand, I first check if the brand is already tied to a product before deleting. CREATE PROCEDURE SP_Delete_MarcasProdutos @Id int AS…
-
3
votes2
answers50
viewsBusiness Exception is not in the Clientejb classpath
I have the following situation: EJB PROJECT public BussinessException extends Exception {} public MyInterfaceImplementation implements MyInterface {} EJB PROJECT CLIENT public interface MyInterface…
-
3
votes1
answer495
viewsDjango - How to treat Exception returned when I try to access a view protected by Developer @login_required?
When Exception occurs I want to redirect to a denied access template! The project in Github py views. # -*- coding: utf-8 -*- ## --------------------------- IMPORTS from django.shortcuts import…
-
3
votes1
answer2814
viewsVia java reflection, set and take values of inherited variables
I have the following class hierarchy (POSTRequestHTTP extends ReqeustHTTP) (RequestHTTP extends ComunicationObjectHTTP ) Assuming that each object can have variables corresponding to an item in a…
-
3
votes1
answer411
viewsHow to get the specific type of error returned by the Entityframework?
Following the question: How to intercept exceptions when working with the Entity Framework? Is it possible to get any error type identifier? For example, Primary Key Violation, Foreign Key…
-
3
votes4
answers3475
viewsHow to return 2 variables of a function
I am accessing a webservice, that has as return: listProdutos[] -> List of all products or null when there are no products When you lose access for some reason, you make an exception, in which…
-
3
votes1
answer744
viewsHow to treat exception released "Integrity Constraint Violation: Cannot delete or update a Parent Row: a Foreign key Constraint fails"?
I use the class PDO for communication with the banco de dados and I don’t know a good way to capture this exceção. I looked for a class that extends PDOException but I didn’t find. I can do a query…
-
3
votes1
answer92
viewsException mapping . NET for HTTP status codes
Situation I’m working on one Httpmodule who is responsible for monitoring usage patterns and intercepting and managing untreated exceptions in ASP.NET applications via events BeginRequest,…
-
3
votes3
answers1909
viewsTry/catch does not show correct message
Guys, I have a C# code that has the code: Uri resultadoURL; bool resultado = Uri.TryCreate(Configuracoes.Configuracao.URL, UriKind.Absolute, out resultadoURL) && resultadoURL.Scheme ==…
-
3
votes3
answers126
viewsRun block if no exception occurs
I want to know if you can perform a function, a block, case NAY there was an exception in try {..}. Example: try { sout("Texto na tela"); } catch(Throwable t) { sout("Ocorreu uma exceção"); }…
-
3
votes2
answers208
viewsI need a code that gives the error Accessviolationexception
My teacher passed a series of exercises and in them I need to create a code to give the error AccessViolationException. However I am not able to create a code that of this error (I am not willing to…
-
3
votes2
answers950
viewsHow to create Exceptions to handle statement with Mysqli
I’m migrating from PDO to Mysqli and when I was doing some operation with the bank, the verification block was like this: $query = $db->prepare("ppapapa sql sql"); try { $query -> execute();…
-
3
votes2
answers102
viewsCan an Exception cause a Sqlconnection to close?
I’m building the treatment of a connection and I came up with this question in mind, yet I couldn’t find a satisfactory answer. So I came here to ask the most experienced programmers. Is there any…
-
3
votes1
answer171
viewsIs it possible to send all Java Exceptions by email?
I have a Java Web application, using Spring MVC, and would like to email all Exceptions released on the system. Is it possible to do that? Set up a default email to receive all Exceptions and…
-
3
votes1
answer199
viewsHow to launch custom T-SQL exception?
I have a Tigger for CPF validation, and I want to make an exception if the reported CPF is invalid. About the release of exceptions I’ve been reading this publishing, but in the author’s examples he…
-
3
votes1
answer63
viewsNullreferenceexception using Htmlagilitypack
I wonder how many tags <a> exist within a div, but the Exception NullReferenceException is fired when arriving on Xpath. var baseURL = "AQUI VAI A MINHA URL"; var client = new HtmlWeb(); var…
c# .net exception html-agility-pack nullpointerexceptionasked 8 years, 7 months ago Gabriel Bernardone 563 -
3
votes1
answer379
viewsChained exceptions in Python
I am in doubt in a situation not so common but that I have seen some developers use that is the case of the string of exceptions. I read the Python documentation about them but it was not as clear…
-
3
votes1
answer301
viewsException divided by zero in Java
Why this generates an Arithmeticexception / by zero: for (int i = 1; i <= 5; i++) { System.out.println(i); int a = i / 0; System.out.println(a); } And that’s not (print "Infinity")? for (int i =…
-
3
votes1
answer85
viewsClosing requests
I currently make several HTTP/HTTPS requests to different websites using the classes HttpWebRequest and HttpWebResponse using framework .NET 4.0*. We are facing a problem when there comes a time we…
-
3
votes1
answer73
views"unwrapping an Optional value" error in login screen transition
Whenever I will do the screen pass with login and password my application to with the error below: fatal error: unexpectedly found nil while unwrapping an Optional value Function Signature…
-
3
votes1
answer46
viewsAre there problems in declaring many noexcept functions?
I see a lot of code in C++14/C++17 where the programmer is sure that the function will make an exception, but does not report this pro compiler, perhaps because it may cause some problem when…
-
3
votes1
answer88
viewsCan you store a throw in a variable?
I have the following code snippet: try { throw new BadRequestHttpException("Error in Register of your Company"); } catch (BadRequestHttpException $e) { throw $e } I want to know if it is possible…
-
3
votes1
answer42
viewsHow to handle an error within any Python class?
If I do something like: class Foo(object): pass print(Foo().python) **OUTPUT:** AttributeError: 'Foo' object has no attribute 'python' How can I treat this exception within my class, rather than…
-
3
votes1
answer302
viewsWhen to use Exceptions in PHP?
I arrived in a module of the OOP PHP workbook on Handling Exceptions, I practiced the exercises and such, but I’m still not quite sure when I should use them, and why. I did a search and found this:…
-
3
votes2
answers8686
viewsHow to Resolve "Object Reference not set to an instance of an Object"?
namespace RepositorioLivrosICC { public class RepositorioLivros { public static RepositorioLivros instance = null; private List<Livro> repositorioLivros; private int indice; public static…
-
3
votes1
answer11435
viewsWhat is java.util.Concurrentmodificationexception?
What causes this exception? How to prevent this exception? How to correct it? Example: I have an Arraylist where I keep several films in a table (Jtable) where I remove the films so as not to rent…
-
3
votes2
answers1115
viewsTreatment of exceptions in C++
I have a question regarding the treatment of exceptions in C++, the class Fracao below is purposely incomplete does not even possess setters or getters and several things have been "set aside", has…
-
3
votes1
answer459
viewsRun log method whenever Exception ASP.NET MVC (Exception Handling) occurs
I need to implement Error Log in my application ASP.NET MVC, My question is the following, is there any way I could trigger a method (This would be a method that would save the error log, send the…
-
3
votes2
answers347
viewsIgnore a specific Exception
In my try-catch, I want to record the exception that occurred within an object (for historical effect, necessary for the business rule, since this section takes place in a processing via integration…
-
3
votes2
answers4675
viewsException Treatment REST Spring Services
In a REST service application with Spring, where should the exception handling/release take place? In the Controller or Service? Example 1 - Handle in Controller (In this case I’m only returning a…
-
3
votes1
answer123
viewsHow to present the untreated exceptions?
Every application fails, it’s a fact. In a Windows desktop application, when an untreated exception bursts, the following explodes on the user’s screen by closing the program: Is not a blue screen,…
-
3
votes2
answers1622
viewsTry/Catch Pdoexception does not work when error occurs
I created the following method to execute my querys: public function setQuery($query) { try { $stmt = self::$conn->prepare($this->limpaQuery($query)); return $stmt->execute(); } catch…
-
3
votes2
answers825
viewsLambda in Java 8 launching Exception
I have the following problem. I need to perform a user update process and your group, and to perform the change I perform the user search, validating if it exists and soon after, I look for the…
-
3
votes0
answers1472
viewsSystem.Threading.Threadabortexception: Thread was being undone. While consuming webservice operation
I have the following code: proxy_hom_recepcionarLoteRps.RecepcionarLoteRPS proxy = new proxy_hom_recepcionarLoteRps.RecepcionarLoteRPS(); proxy.Url = url + "/arecepcionarloterps"; string resp =…
-
3
votes2
answers113
viewsIs there any difference between the two ways of making an exception?
Between the two formats below, the throw can be summed up, or create a new object, when casting exception, I just wanted to understand what the real meaning of writing this in different ways, has…
-
3
votes1
answer2683
viewsUse status code 422 for Invalidargumentexception type exceptions
According to the PHP documentation the exception InvalidArgumentException should be used when an argument not expected by the application is received. Second status code 400 and 422 on the website…