public static UserCodeException wrap(Throwable t) {
    if (t instanceof UserCodeException) {
      return (UserCodeException) t;
    }

    return new UserCodeException(t);
  }
@Test
  public void existingUserCodeExceptionsNotWrapped() {
    UserCodeException existing = UserCodeException.wrap(new IOException());
    UserCodeException wrapped = UserCodeException.wrap(existing);

    assertEquals(existing, wrapped);
  }