我想确保评估aBlock只会引发SomeCustomError类型的错误。有没有比使用isKindOf更好的方法:?重新排列异常,除非它们属于某种类型
aBlock
on: Core.Error
do: [:ex |
(ex isKindOf: SomeCustomError)
ifTrue: [ex pass]
ifFalse: [(SomeCustomError identification: #generalError messageText: ex messageText) raise]]
此代码在导入器类中使用,我希望导入功能在导入出错时仅抛出SomeCustomError。但#XMLate:XML.Schema 有时会抛出纯粹的错误异常。 – Cantillon