[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to make sure some operations in ANY situation? (aka: with statement in Python)
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 20 Jun 2011 17:30:13 +0200
2011/6/20 Xavier Wang <firstname.lastname@example.org>:
> But I have some things to do even if I want throw the error, I want to
> execute some code when the function I called have error, even if I don't
> care what error it does , I just want some resource to be clean .
Ah, like this?
local ok, err = pcall(problem_function)
if not ok then
That is, re-raise the error.