Typed runtime errors implement SPLException
with a .kind string. You can catch
them with structured try/except in SPL.
error.DivisionByZeroError — e.g. math.div by zeroerror.IndexOutOfRangeError — list, string, tuple boundserror.UndefinedVariableError — unknown identifiererror.FileNotFoundError / error.IOError — file I/O
Handlers are merged when error.try():
is immediately followed by one or more
error.except(...): blocks. String
literals can match .kind as well.