Questions tagged [throwable]

The `Throwable` class is the superclass of all errors and exceptions in the Java programming language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java VM or could be thrown by the Java `throw` statement.

The Throwable class is the superclass of all errors and exceptions in the Java programming language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java VM or could be thrown by the Java throw statement. Similarly, only this class or one of its subclasses can be the argument type in a catch clause. For the purposes of compile-time checking of exceptions, Throwable and any subclass of Throwable that is not also a subclass of either RuntimeException or Error are regarded as checked exceptions.

For the further details and reference the documentation for Class Throwable.

165 questions
0
votes
4 answers

Catching Throwable in Blackberry Java: Good Idea?

I often see catch clauses for Throwable in Blackberry documentation, such as the Network API docs. My sense is that this is not generally a good practice in Java. Is there a reason for this in Blackberry programming? Does it have to do with stack…
Matthew
  • 44,826
  • 10
  • 98
  • 87
0
votes
0 answers

how to disable throwing Exceptions or fillInStackTrace() in Java

I am trying to make my application fast. It relies on multi threaded http requests. Each time a request gets an error, it seems, the entire program slows down...(even though the requests are on separate threads) I figure this may be due to…
makmak
  • 151
  • 11
0
votes
3 answers

What would be a good reason to catch throwable?

I read a lot of stuff about why you should not catch "Throwable". That's not what I'm asking, since this is very obvious to me. But what would actually be cases, where it would make sense to do that? I see it here and there and to me, code like that…
codepleb
  • 10,086
  • 14
  • 69
  • 111
0
votes
0 answers

How to resolve java.lang.Throwable?

from SplashScreenActivity i'm calling another Activity. SplashScreenActivity.java if (CheckInternet.isInternetConnection(SplashScreenActivity.this)) { if (CheckInternet.isInternetConnection(SplashScreenActivity.this)) { Log.e(TAG,…
0
votes
2 answers

How to type a function in scala that may throw an exception?

I like to indicate that a function might throw an exception. Currently, I have a few validation functions in the form of: val throwUnlessX: String => Unit = (foo: String) => { if (foo != "bar") { throw new Throwable("Poit!") } } It's typed…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
0
votes
1 answer

Exceptions with more than one inner exception and using streams

How can i process A Multi exception Exception on a file with multiple issues to be reported. I have a case of multi processing step where different exceptions can occur (e.g they will be made asynchronous later). I am using (might be anti-pattern…
Dexters
  • 2,419
  • 6
  • 37
  • 57
0
votes
2 answers

Creating an Exception for a method

Hello I'm still new to programming and I have recently learned about Exceptions and how it is better to Define a exception than use a generic one. I have researched and I understand the basic idea of Creating exceptions such as using String and…
McGhee
  • 13
  • 5
0
votes
1 answer

errors in PHP 7 not being thrown

It's my understanding, per http://php.net/manual/en/language.errors.php7.php, that errors in PHP7 are now supposed to be thrown. But in my own testing this does not seem to be the case:
neubert
  • 15,947
  • 24
  • 120
  • 212
0
votes
1 answer

How to parse the error message in Throwable in Android

I get the error message string(ex.getMessage()) from Throwable in Android like below {"message":"Authorization has been denied for this request."} What is the best way to get only the message part from this error message string?
user689072
  • 134
  • 8
0
votes
6 answers

Is there anything wrong with my Factory class?

class PieceFactory { @SuppressWarnings("rawtypes") public Piece createPiece(String pieceType) throws Throwable{ Class pieceClass = Class.forName(pieceType); Piece piece = (Piece) pieceClass.newInstance(); …
Smooth Operator
  • 197
  • 2
  • 4
  • 15
0
votes
1 answer

Throwable not catching include and require

I have a problem. Throwable doesn't return an exception for require or include functions. Is there any way to "fix" it? Code: try { include 'non-existent-file.php'; #require 'non-existent-file.php'; } catch (\Throwable $ex) { …
Trawlr
  • 149
  • 2
  • 8
0
votes
0 answers

Java not recognizing custom exception class and not compiling?

I have been working on a program to control an L.E.D. matrix with a RaspberryPi 3B+ and I wanted to structure my program so each Matrix would be an array of MatrixComponents. package matrixcontroller; public class MatrixComponent throws…
0
votes
2 answers

Serialization/deserialization with GZIP Sterams isn't consitent

I have the following peace of code that tries to serialize/deserialize a Throwable public void test() throws IOException, ClassNotFoundException { IllegalStateException exception = new IllegalStateException("Oooops!"); ByteBuffer seralized…
Alexandru Barbarosie
  • 2,952
  • 3
  • 24
  • 46
0
votes
3 answers

How to solve java.lang.NoClassDefFoundError occurring within the same jar?

I have the below method in class A. All classes A,B,C and the main class from which 'A' is invoked are in the same jar. public class A { private static void init() { if (!init) { synchronized (B.class) { …
0
votes
1 answer

Throwable onError component of subscription not compiling as expected

Trying to set up monitoring of the RxAndroidBle connection status with an Observable. The code below compiles (I'm unable to test it yet), but I don't fully understand why. The second parameter of the subscribe call is supposed to be…
Robert Lewis
  • 1,847
  • 2
  • 18
  • 43