After looking into all options, it seems that ApexPages.Severity.FATAL and ApexPages.Severity.ERROR are exactly the same. Is there a difference that I'm not aware of?
-
I always used Error, but I think they behave the same, I am curious on what's the actual difference if there is.– raym0ndMar 22, 2016 at 20:29
-
I also use error, but I found a question while studying for Platform Developer II which gave a situation and asked if you should use error or fatal and then when I looked it up, I only saw documentation listing what the options are– brezotomMar 22, 2016 at 20:36
-
I have a feeling it's only to differentiate the severity of the error. So Fatal is basically a higher severity Error.– raym0ndMar 22, 2016 at 20:55
1 Answer
The Fatal level is intended to materialize errors that occur at the platform level, while the Error level is intended for errors that are not strictly fatal, which accounts for pretty much every error that we developers have control over. For example, a Fatal error might be when SOSL fails to run because the search sub-system is down, while a normal Error might be when the user types in an invalid date. In other words, you should generally be using Error, and leave Fatal alone.