[Tutor] Inherit from SyntaxError?
Cameron Simpson
cs at cskk.id.au
Tue Mar 21 17:11:39 EDT 2023
On 21Mar2023 18:07, Albert-Jan Roskam <sjeik_appie at hotmail.com> wrote:
> Thanks! I now created one BaseParserError (inherits from
> SyntaxError)
> and a lexer + parser error (they each inherit from BaseParserError).
Sounds good.
> So, is MemoryError the only really tricky exception? I mean, the
> interpreter might just die before it is able to recover from the
> MemoryError?
You probably can't do anything about this. What kind of recovery would
you do? And why?
Remember the rule: only catch things you have a meaningful action to
catch (there are reare exceptions, usually around daemon like activity
where you're running some task: catch and log the exception, and poceeed
to the next task/request - you're not "recovering" or repairing here,
just not terminating some outer framework).
What's tricky about a MemoryException? Just let it out, like a bunch of
other "system" type exceptions. Can you describe what you want to do
with MemoryError?
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Tutor
mailing list