exception

Is a 'recoverable error' interface more efficient than handling recovery in multiple 'catch' blocks?

非 Y 不嫁゛ 提交于 2021-01-07 06:35:58
问题 So, this is a re-ask of another question that was closed for being opinion based. So I'm re-asking my question in a more factual manner. So, as the title says, I'm unsure if I should try to implement recoverable error classes or just stick with trying to recover in a catch block. Some psuedo-code to demonstrate: // more or less what I have now postToServer(data) { try { socket.write(data) } //Interrupted being a custom exception catch(Interrupted ex) { //happened twice is a common static

FP: invalid operation: contradiction between C (UB) and IEEE 754 (WDB)?

北城以北 提交于 2021-01-07 01:06:06
问题 N2479 C17..C2x working draft — February 5, 2020 ISO/IEC 9899:202x (E): 6.3.1.4 Real floating and integer: 1 When a finite value of standard floating type is converted to an integer type other than _Bool, the fractional part is discarded (i.e., the value is truncated toward zero). If the value of the integral part cannot be represented by the integer type, the behavior is undefined . IEEE 754-2019: 5.8 Details of conversions from floating-point to integer formats: When a NaN or infinite

std::async and lambda function in C++ gives no associated state

别来无恙 提交于 2021-01-03 06:25:24
问题 I'm trying to obtain a better performance in my program by using async whenever this is convenient. My program compiles, but I get the following error every time I use a function containing async calls: C++ exception with description "No associated state" The way I am trying to call async with a lambda is e.g. as follows: auto f = [this](const Cursor& c){ return this->getAbsIndex(c); }; auto nodeAbsIndex = std::async(f,node); // node is const Cursor& auto otherAbsIndex = std::async(f,other);

Catching Exceptions in async methods when not called with await

女生的网名这么多〃 提交于 2021-01-03 05:35:40
问题 Goal: I am confused by the behavior I am seeing with exceptions in my .Net Core library. The goal of this question is to understand why it is doing what I am seeing. Executive Summary I thought that when an async method is called, the code in it is executed synchronously until it hits the first await. If that is the case, then, if an exception is thrown during that "synchronous code", why is it not propagated up to the calling method? (As a normal synchronous method would do.) Example Code:

Catching Exceptions in async methods when not called with await

冷暖自知 提交于 2021-01-03 05:34:34
问题 Goal: I am confused by the behavior I am seeing with exceptions in my .Net Core library. The goal of this question is to understand why it is doing what I am seeing. Executive Summary I thought that when an async method is called, the code in it is executed synchronously until it hits the first await. If that is the case, then, if an exception is thrown during that "synchronous code", why is it not propagated up to the calling method? (As a normal synchronous method would do.) Example Code:

java.lang.ClassCastException: java.io.ObjectStreamClass cannot be cast to java.lang.String

寵の児 提交于 2021-01-02 05:38:29
问题 I am getting following stacktrace error while running web application on tomcat, unable to find root cause of this exception. Eclipse 32 bit Luna Release (4.4.0) Tomcat 32 bit 8.0.30 jdk1.8.0_66 Jan 01, 2016 10:02:16 AM org.apache.catalina.session.StandardManager startInternal SEVERE: Exception loading sessions from persistent storage java.lang.ClassCastException: java.io.ObjectStreamClass cannot be cast to java.lang.String at java.io.ObjectInputStream.readTypeString(ObjectInputStream.java

java.lang.ClassCastException: java.io.ObjectStreamClass cannot be cast to java.lang.String

安稳与你 提交于 2021-01-02 05:37:10
问题 I am getting following stacktrace error while running web application on tomcat, unable to find root cause of this exception. Eclipse 32 bit Luna Release (4.4.0) Tomcat 32 bit 8.0.30 jdk1.8.0_66 Jan 01, 2016 10:02:16 AM org.apache.catalina.session.StandardManager startInternal SEVERE: Exception loading sessions from persistent storage java.lang.ClassCastException: java.io.ObjectStreamClass cannot be cast to java.lang.String at java.io.ObjectInputStream.readTypeString(ObjectInputStream.java

Letting CompletableFuture exceptionally() handle a supplyAsync() Exception

时间秒杀一切 提交于 2021-01-01 04:20:34
问题 The question is rather simple: I'm looking for an elegant way of using CompletableFuture#exceptionally alongside with CompletableFuture#supplyAsync . This is what does not work: private void doesNotCompile() { CompletableFuture<String> sad = CompletableFuture .supplyAsync(() -> throwSomething()) .exceptionally(Throwable::getMessage); } private String throwSomething() throws Exception { throw new Exception(); } I thought the idea behind exceptionally() was precisely to handle cases where an

Letting CompletableFuture exceptionally() handle a supplyAsync() Exception

瘦欲@ 提交于 2021-01-01 04:17:58
问题 The question is rather simple: I'm looking for an elegant way of using CompletableFuture#exceptionally alongside with CompletableFuture#supplyAsync . This is what does not work: private void doesNotCompile() { CompletableFuture<String> sad = CompletableFuture .supplyAsync(() -> throwSomething()) .exceptionally(Throwable::getMessage); } private String throwSomething() throws Exception { throw new Exception(); } I thought the idea behind exceptionally() was precisely to handle cases where an

Visual Studio 2017 studio showing error 'This application is in break mode' and throws unhandled exception

血红的双手。 提交于 2020-12-30 07:58:21
问题 I am developing a Xamarin.Android app. Whenever i try to download a JSON feed I get the error "Your app has entered a break state, but there is no code to show because all threads were executing external code" . Here's the screenshot of error My json feed download code string url = "http://xamdev.epizy.com/getData1.php"; public async void downloadJsonFeedAsync(String url) { var httpClient = new HttpClient(); Task<string> contentsTask = httpClient.GetStringAsync(url); // await! control returns