How would I keep track of exceptions so that I could find out whether or not they have been handled or not?
假设我有一些错误处理代码:
def errorWindow(self, error_):
self.filewin = Toplevel(self.master)
self.NothingLabel = Label(self.filewin,text=error_,justify=CENTER)
self.NothingLabel.pack()
self.nbutton = Button(self.filewin, text="OK", command=self.filewin.destroy)
self.nbutton.pack(pady=5)
# When it is called it looks something like this:
try:
# Function that is being checked for exceptions
except Exception as e:
error_ = 'Failure the following error was encountered: \n {}'.format(e)
self.errorWindow(error_)
我想做的是使用我构建的函数来处理我期望在用户端发生的错误。我想有一个函数,也创建了一个错误窗口时,用户发生的错误,我不期望。理想情况下,只有在发生异常时才会发生这种情况。那么,有没有一种方法来识别和跟踪特定的异常,以便我可以用一种不同于预期的方式来处理意外错误呢
目前没有回答
相关问题 更多 >
编程相关推荐