Are you tired of JVMs crap? Done with handling some meaningless NullPointerException
? Tired of throwing some other lame ass exception because somehow someone got your code in a state it never should have gotten into?
Take a deep breath, and let me introduce the Frybit WTF exception library (exclusively for Kotlin)!
Let's start of with something simple... feel like flipping that desk of yours? Whoa! Wait, no... don't really do it. Let's do it in code instead:
fun someDamnFunction() {
// Some damn code
// Suddenly, an error appears out of nowhere!
throw `┳━┳`
// Throwable message: "(┛ಠ_ಠ)┛彡┻━┻"
}
Easy, no? Oh... you hate the ASCII stuff? Just calm down there and breath. We can do this instead:
fun someDamnFunction() {
// Some damn code
// Suddenly, an error appears out of nowhere!
throw TheDamnTable
// Throwable message: "(╯°□°)╯︵ ┻━┻"
}
There, don't you feel better? Let's see what else we can throw, shall we?
fun someDamnFunction() {
// Some damn code
// Suddenly, an error appears out of nowhere!
throw `(╯°□°)╯︵ ┻━┻`() // Throwable message: "FFFFFUUUUUU~~~!"
// You can also do the following if you don't like the default message
// throw `(╯°□°)╯︵ ┻━┻`("someChoiceWords")
}
Can't find a table? Not a problem, let's just use our words instead!
fun someDamnFunction() {
// Some damn code
// Suddenly, an error appears out of nowhere!
throw SomeChoiceWords() // Throwable message: "( ゚Д゚)<!! FFFFFUUUUUU~~~!"
// You can also do the following if you don't like the default message
// throw SomeChoiceWords("someChoiceWords") // Throwable message: "( ゚Д゚)<!! someChoiceWords"
}
Sometimes, users like doing things they shouldn't. Let's handle this appropriately:
fun someDamnFunction() {
// Some damn code
// Suddenly, a random user breaks stuff!
throw `(´・_・')` // Throwable message: "(╯°Д°)╯︵/(.□ . \)"
// Again, if ASCII is not your thing...
throw TheDamnUser // Throwable message: "(╯°Д°)╯︵/(.□ . \)"
}
Maybe you've had it up to here with everything...
fun someDamnFunction() {
// Some damn code
// Damnit, it's all gone to hell!
throw `EVERYTHING!!!` // Throwable message: "┻━┻︵ \(°□°)/ ︵ ┻━┻"
}
Wait a minute? Are you really planning on using this library for real debugging? Well... ok. Let's give you a way to preserve that stack trace... just don't include this in your PR (unless you are really done with other people's crap):
fun someDamnFunction() {
try {
// Some damn code
} catch (e: Exception) {
// What kind of crap is this?!
throw becauseOfThisCrap(e) // Just look at the stack trace...
}
}
Oh no! Are you feeling some regret for your actions? Do you wish you could just catch some of these exceptions appropriately? Don't worry, I have you covered. ◕ ◡ ◕
fun someHappyCode() {
// Happy little code here
// Let's not regret this decision
catchWtf {
someDamnFunction()
}
}