Throwing exception in constructor

Stijn Herreman stijn.herreman at telenet.be
Tue Aug 16 10:08:53 PDT 2011


Why is the return statement required, while nothing after the Exception 
is executed?
Error: one path skips constructor

	public this(string p1, string p2, string p3)
	{
		string json = download_string(...);
		
		if (json is null)
		{
			throw new Exception("404");
			writeln("test");
			return;
		}
		else
		{
			this(json);
		}
	}
	
	package this(string json)
	{
		...
	}


More information about the Digitalmars-d-learn mailing list