我偶尔会收到 OAuthException 并试图通过以下方式捕获它:
rescue OAuthException => exception
# exception handling code here
但是我得到:
rescue in <main>': uninitialized constant OAuthException (NameError)
知道我错过了什么吗?
==== 更新
这是我目前解决的方法。我必须做一个 message.match() 的事实似乎有点 hacky。
rescue GemModule::GemSubmodule::APIError => exception
if exception.message.match("OAuthException")
有什么改进吗?