Questions tagged [custom-exceptions]

Custom Exception inherits the properties from the Exception class. Whenever we declare our own exception, it is known as custom exception.

Custom Exception inherits the properties from the Exception class. Whenever we declare our own exception, it is known as custom exception.

242 questions
2
votes
1 answer

Custom exceptions in CodeIgniter

I want to extend the exception class that returns custom message when getMessage is called. class MY_Exceptions extends CI_Exceptions{ function __construct(){ parent::__construct(); } function getMessage(){ $msg =…
Krishna Sarma
  • 1,852
  • 2
  • 29
  • 52
2
votes
2 answers

list of custom defined exceptions. How to create such a list?

Is there any way where we can store the user defined exceptions (our customized exceptions) in a list? So that if any other exception occurs, which is not in list.. the program should simply be aborted.
NikAsawadekar
  • 57
  • 1
  • 5
2
votes
1 answer

Create Exception class; nonvisibility from other classes

package Exception; public class Exceptions { public class NoSpaceException extends RuntimeException { public NoSpaceException(){ super("There is not enough room in the set for another element."); } } public…
gator
  • 3,465
  • 8
  • 36
  • 76
2
votes
1 answer

How to display Primefaces dialog (dialog framework) as part of CustomExceptionHandler

I have a CustomExceptionHandler from which I want to display a modal dialog to get some information from the user, using Primefaces dialog framework. The CustomExceptionHandler#handle method is being called as expected when I deliberately cause a…
CraftWeaver
  • 707
  • 1
  • 8
  • 21
2
votes
2 answers

Python magic method to alter the way raising an object is handled

I was wondering, is there a simple magic method in python that allows customization of the behaviour of an exception-derived object when it is raised? I'm looking for something like __raise__ if that exists. If no such magic methods exist, is there…
user3002473
  • 4,835
  • 8
  • 35
  • 61
2
votes
1 answer

Java Exception Handling custom class

I am having trouble handling some exceptions. It would be great if you could point me to a direction so I can understand exceptions better as well as learning to handle exceptions more efficient. Through the commandline argument it splits a single…
2
votes
6 answers

How can I get the name of the class that throws a custom made Exception

I'm preparing a project for college where I need to write a custom made exception that will be thrown by a couple of classes in the same package when they were not initialized properly. The problem is that I must let the user know which of those…
y0n1
  • 166
  • 1
  • 9
2
votes
2 answers

Java - how to overwrite getMessage() for custom checked and unchecked exceptions using one implementation?

How to have MyException and MyRuntimeException use the same custom getMessage() implementation? As Java does not come with multiple inheritance I don't know what to do. At the moment I have duplicate code in both classes... Important detail:…
Gerrit
  • 365
  • 1
  • 3
  • 19
2
votes
2 answers

In JSF, a custom exception thrown by called EJB is seen as EJBTransactionRolledBackException or NullPointerException or ServletException

Here's the problem: The EJB throws this exception (from the glassfish logs): SEVERE: Attempting to confirm previously confirmed login using confirmation UUID:…
Bill Rosmus
  • 2,941
  • 7
  • 40
  • 61
1
vote
2 answers

Returning results/erros from WCF services. Complex type or an exception?

A few days ago I asked a very similar question. I was about returning values/errors inside the application. I accept an answer to not return error as and object but throw an custom exceptions. Now, I'm not exactly sure how to deal with it using WCF…
Marshall
  • 1,195
  • 6
  • 30
  • 47
1
vote
1 answer

Inheritance and static members in Java

I am working on a project which contains a couple of modules. I want to provide the ability in every module to have a custom exception that statically populates internal structure, e.g. HashMap, from property file with custom…
Vik Gamov
  • 5,446
  • 1
  • 26
  • 46
1
vote
1 answer

How to catch a pywin32com exception on opening files

I am trying to open an excel file in python using COM, and trying to catch the file not found error: I first tried catching the IOError: try: output = xl.Workbooks.Open(Params.workbookName) except IOError as reason: print reason exit() But…
Razor Storm
  • 12,167
  • 20
  • 88
  • 148
1
vote
2 answers

How can we create custom class of TextView with custom font in kotlin?

Can anyone help me to define a custom class for android Textview with a custom font in kotlin?
P A Gosai
  • 553
  • 5
  • 22
1
vote
1 answer

Creating exceptions that are co-operative

The Python docs state: Programs may name their own exceptions by creating a new exception class (see Classes for more about Python classes). Exceptions should typically be derivedfrom the Exception class, either directly or …
user11217210
1
vote
2 answers

Spring boot custom exception not getting printed in logs

I am trying to implement a custom exception for my Spring boot REST project. The custom exception gets called but shows no impact in the way error message is displayed. This is the POJO I'm using for my custom errors: public class ApiError { …
Preethi Jha
  • 167
  • 13