1
爲了處理Rails異常,我看到人們會'提出SomeException.new'或'引發SomeException',有什麼區別?Rails提高StandardError.new和提高StandardError的區別
說,如果我有一個類
class UnableToCreateShipments < StandardError; end
我都可以做?
raise UnableToCreateShipments
raise UnableToCreateShipments.new
或Message
raise UnableToCreateShipments, 'my error message'
raise UnableToCreateShipments.new('my error message')
這實際上是Ruby(語言)而不是Rails(網絡框架)。 –