Skip to content

Commit 173e990

Browse files
committed
simplify exceptions for Java, .NET and Python
1 parent c830d03 commit 173e990

74 files changed

Lines changed: 106 additions & 151 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

+stdlib/+dotnet/create_symlink.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
System.IO.File.CreateSymbolicLink(link, target);
1313
ok = true;
1414
catch e
15-
dotnetException(e)
16-
ok = missing;
15+
ok = dotnetException(e);
1716
end
1817

1918
end

+stdlib/+dotnet/disk_available.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.availablefreespace
1515
i = uint64(i);
1616
catch e
17-
dotnetException(e)
17+
dotnetException(e);
1818
end
1919

2020
end

+stdlib/+dotnet/disk_capacity.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.totalsize
1515
i = uint64(i);
1616
catch e
17-
dotnetException(e)
17+
dotnetException(e);
1818
end
1919

2020

+stdlib/+dotnet/file_checksum.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
hash = sprintf('%.2x', uint8(inst.Hash));
2424
catch e
25-
dotnetException(e)
26-
hash = missing;
25+
hash = dotnetException(e);
2726
end
2827

2928
fclose(fid);

+stdlib/+dotnet/filesystem_type.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
try
1515
t = char(System.IO.DriveInfo(System.IO.Path.GetFullPath(file)).DriveFormat);
1616
catch e
17-
dotnetException(e)
17+
dotnetException(e);
1818
end
1919

2020
end

+stdlib/+dotnet/get_owner.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
% This is not yet possible with .NET on Unix, even with .NET 10.
66
% It would require Pinvoke or external Mono.Unix
77

8-
o = missing;
9-
108
try
119
ntAccountType = System.Type.GetType('System.Security.Principal.NTAccount');
1210

@@ -15,14 +13,15 @@
1513
elseif isfile(file)
1614
fsec = System.IO.File.GetAccessControl(file);
1715
else
16+
o = missing;
1817
return
1918
end
2019

2120
owner = fsec.GetOwner(ntAccountType);
2221

2322
o = char(owner.ToString());
2423
catch e
25-
dotnetException(e)
24+
o = dotnetException(e);
2625
end
2726

2827
end

+stdlib/+dotnet/get_process_priority.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
p = System.Diagnostics.Process.GetCurrentProcess();
55
i = double(p.PriorityClass);
66
catch e
7-
dotnetException(e)
8-
i = missing;
7+
i = dotnetException(e);
98
end
109

1110
end

+stdlib/+dotnet/get_uid.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
try
77
u = char(System.Security.Principal.WindowsIdentity.GetCurrent().User.Value);
88
catch e
9-
dotnetException(e)
9+
dotnetException(e);
1010
end
1111
end
1212

+stdlib/+dotnet/get_username.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
try
77
n = char(System.Environment.UserName);
88
catch e
9-
dotnetException(e)
10-
n = missing;
9+
n = dotnetException(e);
1110
end
1211

1312
end

+stdlib/+dotnet/hostname.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
try
99
n = char(System.Net.Dns.GetHostName());
1010
catch e
11-
dotnetException(e);
12-
n = missing;
11+
n = dotnetException(e);
1312
end
1413

1514
% https://learn.microsoft.com/en-us/dotnet/api/system.net.dns.gethostname

0 commit comments

Comments
 (0)