/******************************************************************************* * Copyright (c) 2005, 2014 springside.github.io * * Licensed under the Apache License, Version 2.0 (the "License"); *******************************************************************************/ package io.springside.engine.thrift.utils; /** * 关于异常的工具类. * * 参考了guava的Throwables。 * * @author calvin */ public class Exceptions { /** * 将CheckedException转换为UncheckedException. */ public static RuntimeException unchecked(Throwable ex) { if (ex instanceof RuntimeException) { return (RuntimeException) ex; } else { return new RuntimeException(ex); } } }