Scope failure is not preventing application crush in case of uncaught exceptions

kerdemdemir kerdemdemir at gmail.com
Sat Dec 16 20:51:09 UTC 2017


While calling this function :

bool PublicMarketCall( ref Json result )
{
   string fullUrl = 
"https://bittrex.com/api/v1.1/public/getmarketsummaries";
   Json data;
   try
   {
   	requestHTTP(fullUrl,
   		(scope req) {
   			req.method = HTTPMethod.GET;
   		},
   		(scope res) {
   			data = parseJsonString(res.bodyReader.readAllUTF8());	
   		}
   	);
   }
   catch ( std.json.JSONException e )
   {
   	writeln("Exception was caught while making the public call: ", 
fullUrl);
   	return false;
   }

   scope(failure)
   	writeln("Exception was caught while public data: ", fullUrl);
   return false;
}

Very rarely (I am calling this function thousands of times in a 
day) like once in a day I am getting a crush while calling 
requestHTTP function :

object.Exception at ../../../.dub/packages/vibe-d-0.8.1/vibe-d/core/vibe/core/drivers/libevent2.d(375): Failed to connect to host 104.17.154.108:443: 7FF703F4F617
----------------
??:? [0x606cee]
??:? [0x60ceb2]
exception.d:421 [0x4644a3]
exception.d:388 [0x41396d]
libevent2.d:375 [0x59002b]
net.d:129 [0x5be726]
client.d:610 [0x4a8ed4]
client.d:528 [0x4a7224]
client.d:462 [0x4a5a3f]
client.d:157 [0x4a5819]
client.d:133 [0x4a52bf]
.... --> Some files belonging my function
app.d:41 [0x43b947]
??:? [0x612f3e]
??:? [0x612efd]
??:? [0x612df8]
__entrypoint.d:8 [0x43be54]
??:? __libc_start_main [0x3de282f]
??:? [0x406fb8]
Program exited with code 1

As far as I know scope(failure) should be collecting all failure 
cases. And my application shouldn't crush with uncaught 
exceptions. What I am missing?






More information about the Digitalmars-d-learn mailing list