Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
1
Task/Exceptions/Ada/exceptions-1.adb
Normal file
1
Task/Exceptions/Ada/exceptions-1.adb
Normal file
|
|
@ -0,0 +1 @@
|
|||
Foo_Error : exception;
|
||||
4
Task/Exceptions/Ada/exceptions-2.adb
Normal file
4
Task/Exceptions/Ada/exceptions-2.adb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
procedure Foo is
|
||||
begin
|
||||
raise Foo_Error;
|
||||
end Foo;
|
||||
6
Task/Exceptions/Ada/exceptions-3.adb
Normal file
6
Task/Exceptions/Ada/exceptions-3.adb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
...
|
||||
exception
|
||||
when Foo_Error =>
|
||||
if ... then -- Alas, cannot handle it here,
|
||||
raise; -- continue propagation of
|
||||
end if;
|
||||
9
Task/Exceptions/Ada/exceptions-4.adb
Normal file
9
Task/Exceptions/Ada/exceptions-4.adb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
procedure Call_Foo is
|
||||
begin
|
||||
Foo;
|
||||
exception
|
||||
when Foo_Error =>
|
||||
... -- do something
|
||||
when others =>
|
||||
... -- this catches all other exceptions
|
||||
end Call_Foo;
|
||||
12
Task/Exceptions/Ada/exceptions-5.adb
Normal file
12
Task/Exceptions/Ada/exceptions-5.adb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
with Ada.Exceptions; use Ada.Exceptions;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Main is
|
||||
begin
|
||||
...
|
||||
Raise_Exception (Foo_Error'Identity, "This is the exception message");
|
||||
..
|
||||
exception
|
||||
when Error : others =>
|
||||
Put_Line ("Something is wrong here" & Exception_Information (Error));
|
||||
end Main;
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
val safediv = fn(x, y) { x / y ; catch : 0 }
|
||||
val safediv = fn(x number, y number) { x / y ; catch : 0 }
|
||||
safediv(7, 7) # 1
|
||||
safediv(7, 0) # 0
|
||||
|
|
|
|||
22
Task/Exceptions/Pluto/exceptions.pluto
Normal file
22
Task/Exceptions/Pluto/exceptions.pluto
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local function get_day_no(day)
|
||||
-- Throws an error if day is invalid.
|
||||
return switch day:lower() do
|
||||
case "monday" -> 1
|
||||
case "tuesday" -> 2
|
||||
case "wednesday" -> 3
|
||||
case "thursday" -> 4
|
||||
case "friday" -> 5
|
||||
case "saturday" -> 6
|
||||
case "sunday" -> 7
|
||||
default -> error($"'{day}' is not a valid day in English.")
|
||||
end
|
||||
end
|
||||
|
||||
for {"thursday", "jeudi"} as day do
|
||||
local ok, res = pcall(get_day_no, day)
|
||||
if ok then
|
||||
print($"'{day}' is day number {res}")
|
||||
else
|
||||
print(res)
|
||||
end
|
||||
end
|
||||
1
Task/Exceptions/PowerShell/exceptions-1.ps1
Normal file
1
Task/Exceptions/PowerShell/exceptions-1.ps1
Normal file
|
|
@ -0,0 +1 @@
|
|||
throw "Any error message."
|
||||
1
Task/Exceptions/PowerShell/exceptions-2.ps1
Normal file
1
Task/Exceptions/PowerShell/exceptions-2.ps1
Normal file
|
|
@ -0,0 +1 @@
|
|||
throw [System.IO.FileNotFoundException] ".\temp.txt not found."
|
||||
12
Task/Exceptions/PowerShell/exceptions-3.ps1
Normal file
12
Task/Exceptions/PowerShell/exceptions-3.ps1
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
try
|
||||
{
|
||||
Get-Content -Path .\temp.txt
|
||||
}
|
||||
catch [System.IO.FileNotFoundException]
|
||||
{
|
||||
Write-Host "File not found exception"
|
||||
}
|
||||
catch [System.Exception]
|
||||
{
|
||||
Write-Host "Other exception"
|
||||
}
|
||||
1
Task/Exceptions/PowerShell/exceptions-4.ps1
Normal file
1
Task/Exceptions/PowerShell/exceptions-4.ps1
Normal file
|
|
@ -0,0 +1 @@
|
|||
$Error[0] | Get-Member
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
-- 12 Sep 2025
|
||||
-- 25 Apr 2026
|
||||
include Setting
|
||||
|
||||
say 'EXCEPTIONS'
|
||||
|
|
@ -9,4 +9,5 @@ say 'Square root of 0 is' SqRt(0)
|
|||
say 'Square root of -1 is' SqRt(-1)
|
||||
exit
|
||||
|
||||
-- Abend; Sqrt
|
||||
include Math
|
||||
|
|
|
|||
4
Task/Exceptions/Rye/exceptions.rye
Normal file
4
Task/Exceptions/Rye/exceptions.rye
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
str: "abc"
|
||||
num: 5
|
||||
try { 123 + str } |is-error .either { "error" } { print str }
|
||||
try { 123 + num } |is-error .either { "error" } { print num }
|
||||
2
Task/Exceptions/Uiua/exceptions.uiua
Normal file
2
Task/Exceptions/Uiua/exceptions.uiua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
⍣(⋕|0) "123" # parses okay
|
||||
⍣(⋕|0) "notanumber" # supplies 0 on error
|
||||
Loading…
Add table
Add a link
Reference in a new issue