domain_error problem

Hello, I am compiling this code and I get this funny note under compilation progress:

Error occurred while restoring NuGet packages: System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetDirectoryName(String path)
at NuGet.VisualStudio.VsUtility.GetNuGetSolutionFolder(Solution solution)
at NuGet.VsEvents.PackageRestorer.UsingOldPackageRestore(Solution solution)
at NuGet.VsEvents.PackageRestorer.BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action).

The programm runs, but I can't get the domain_error to work in the function
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  int main()
{
	int x;
	cout << "Enter length: ";
	cin >> x;
	cout << endl;

	cout << returnLength(x) << endl;

	cin.get();
	cin.get();
	return 0;
}

int returnLength(int length)
{
	if (!length)
		throw domain_error("Length must be a positive value and not zero");

	return length;
	
}
The exception is being thrown but never caught.
1
2
3
4
5
6
7
8
9
10
11
int main() {
	try {
		// ...
		
		cout << returnLength(x) << endl;
		
		// ...
	} catch(domain_error &e) {
		cerr << "Domain Error: " << e.what() << endl;
	}
}
Topic archived. No new replies allowed.