throws

    7热度

    2回答

    我在科特林定义的函数: fun convertExceptionToEmpty(requestFunc:() -> List<Widget>): Stream<Widget> { try { return requestFunc().stream() } catch (th: Throwable) { // Log the exception...

    0热度

    3回答

    以此为例子异常的亚型: public class TestClass { public static void test() throws SSLHandshakeException { throw new SSLHandshakeException("I'm a SSL Exception"); } public static void main(S

    -1热度

    1回答

    我看到一些方法抛出Apple的文档中的错误。但是我找不到任何关于它抛出的信息。 像下面这种方法。它在FileManager类中。 func moveItem(at srcURL: URL, to dstURL: URL) throws 我想知道它会抛出什么样的错误。我在哪里可以获得相关信息?

    21热度

    2回答

    在搜索了一些参考文献以找出它之后,我很难找到有用的简单描述来了解throws和rethrows之间的区别。试图了解我们应该如何使用它时,这有点令人困惑。 我会告诉你我有种熟悉的 - 默认throws用最简单的传播错误的形式,如下所示: enum CustomError: Error { case potato case tomato } func throwCustomE

    0热度

    1回答

    当我尝试像发生这种错误写代码: doInBackground“在‘COM ..... QrGenerator‘在’机器人doInBackground(参数...)’与冲突”(字符串...) .os.AsyncTask';重写方法不抛出“com.google.zxing.WriterException” 下面是代码: private class QrGenerator extends AsyncTa

    3热度

    4回答

    我有一个方法,我遍历列表并创建列表。当我这样做时,我调用一个方法(createResult)来给出一个Result也会抛出CustomException,我将其作为ResultClassException封装。但我不断收到一个错误,说未处理的异常。 我的代码: private List<Result> getResultList(List<String> results) throws Resul

    1热度

    2回答

    为什么下面的代码编译正常,但被调用的方法不需要抛出Exception?是不是Exception检查异常,而不是未经检查的异常?请澄清。 class App { public static void main(String[] args) { try { amethod(); System.out.println("try "); } c

    2热度

    5回答

    我有以下方法来实现一个ArrayList,但我不知道如何去处理异常。如果ArrayList为空,它是否会自动抛出异常,或者是否需要在方法中写入某些内容? public T removeLast() throws EmptyCollectionException { //TODO: Implement this. }

    0热度

    1回答

    我试图在抛出异常方法外执行@Test。我能够执行@Test方法的唯一方法是如果我在抛出异常方法中调用它们,并且这会使@Test方法失败。请参阅我的代码。 public class Communication extends WebPortalLogin { public static String driverPath = "C:/"; public static Web

    0热度

    1回答

    public controllerMethod() throws UnsupportedEncodingException { getVehicles(req); } public List<vehicles> getVehicles(A req) throws UnsupportedEncodingException{ someObject.forEach(obj ->