B4J Library [B4x] Throwables library

This is a simple b4xlib library that just allows throwing an IllegalArgumentException or a NumberFormatException.

Sometimes a Toast or Dialog is not enough of an alert that something is going to break if the data passed is incorrect, especially in libraries.

Compatible with B4a and B4j.

Usage:

B4X:
Dim TH as Throwables
TH.Initialize
TH.Throw(Throwables_Static.NewIllegalArgumentException("Invalid Argument"))

or

TH.Throw(Throwables_Static.NewNumberFormatException("Invalid Number"))

The exceptions can be caught in the normal way with a try .. catch block.

Version 1

Tags: throw exception
 

Attachments

  • Throwables-b4xlib.b4xlib
    3.3 KB · Views: 214
Last edited:

stevel05

Expert
Licensed User
Longtime User
Sorry, one Dim jFX slipped through and would obviously break the B4a implementation.

Please download it again now.
 

Waldemar Lima

Well-Known Member
Licensed User
1608776120740.png
 

stevel05

Expert
Licensed User
Longtime User
Sorry, try it again now. and delete the original. I uploaded the wrong file. It should be Throwables-b4xlib.b4xlib
 
Top