X-Git-Url: https://ocean-lang.org/code/?p=ocean-D;a=blobdiff_plain;f=Ocean-errors;h=0141be278d49c32d76ca6ff3b8d5ed89dd34be1b;hp=b677b866ad5e3abc4fee904a1c427345e809c770;hb=c39500ef12ffba7114e3084979679940f83658b6;hpb=62fa958bc69d7b1701376c391a80382d7a7d00d7 diff --git a/Ocean-errors b/Ocean-errors index b677b86..0141be2 100644 --- a/Ocean-errors +++ b/Ocean-errors @@ -10,3 +10,20 @@ I want things to be able to throw errors - or fail-safe(?) when they aren't caught. I could have an 'else' on any simple statement which does error handling + + +Maybe a type that starts '?' can fail to have a value. + +foo: ?int + + foo = 27/0 + + would not trigger an error, but you need + if ?foo: print foo; else print "div by zero" + to use the value + + Most operators will let an error fall through if it is expected. + + If you want details about the error, you need to declare a type that + holds a value or an error. You then get the error code with foo.err or whatever + you have defined.