1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【メモ】raise error

Posted at

Railsのraise errorを知った。例外を送出するものらしい。

raise Exceptions::AutoSaveError
と書いた。

これは故意的に例外を発生させたい時に使うメソッド。raiseはRanTimeErrorと出る。
raise something error
とすると、RunTimeError: something errorと出るらしい。

スクリーンショット 2015-06-13 0.45.20.png

確かに出た!

すべての例外はExceptionクラスを継承していて、その中でStanderdErrorクラスを継承している例外はアプリケーションレベルの例外、継承していないエラー(NoMethodErrorなど)はシステムレベルの例外。

例外について

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?