Introducing a tiny library for throwing Java exceptions: Cy Young

Cy Young

We have deep open source roots at Launchable. From the countless open-source libraries and programs we use every day to make Launchable run, to my own experience with Jenkins and the Jenkins community. When we have a chance to give back to the community it feels good. Today, I'd like to share a tiny little library that we recently open-sourced for making it easier to throw exceptions in Java.

If you're a Java developer, from time to time you run into a situation where you want to be able to throw a checked exception from a context that you can't. For example, stream processing:

public void reportData(Stream<Foo> foos) {;

public Bar report(Foo foo) { // what are you going to do with IOException!? try (OutputStream o = new FileOutputStream(foo.fileName)) { ... } }

Man, if only you could throw any exception from anywhere!

With Cy Young, you can throw any exception from anywhere, like the man himself.

public void reportData(Stream<Foo> foos) throws IOException {;

public Bar report(Foo foo) { try { try (OutputStream o = new FileOutputStream(foo.fileName)) { ... } } catch(IOException e) { CyYoung.pitch(e); // Cy Young with throw an exception for you } }

Handy when you are squeezed between a rock and a hard place. I think about this as "duct tape" that allows you to move on to work on things that really matter.

A little library from the engineering team at Launchable, now available in Maven central:


Your cart