Code Monkey home page Code Monkey logo

frybits-wtf's Introduction

License: MIT

Frybits WTF ಠ_ಠ

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)!

(っ˘▽˘)っ Usage ⊂(◕。◕⊂)

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()
    }
}

frybits-wtf's People

Contributors

pablobaxter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.