Package org.sonar.api.utils
Class MessageException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.sonar.api.utils.MessageException
-
- All Implemented Interfaces:
java.io.Serializable
public class MessageException extends java.lang.RuntimeException
Runtime exception for "functional" error. It aims to be displayed to end-users, without any technical information like stack traces.
It's handling depends on the versions of the sonar-batch and sonar-runner. sonar-runner 2.4 will only show the message associated with this exception. Starting from sonar-batch 5.3, this is handled in the batch side, and the main goal is to hide all wrappers of this exception. If this exception is created without cause, then only the message associated with this exception is shown; otherwise, its causes are also shown. Previous combinations of sonar-batch/sonar-runner log all stack trace.
Message should be clear and complete. Keep in mind that context might not be added to the exception. Names of processed resource and decorator are for example not automatically added when throwingMessageException
fromorg.sonar.api.batch.Decorator
.- Since:
- 3.7.1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MessageException(java.lang.String s)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Throwable
fillInStackTrace()
Does not fill in the stack tracejava.lang.String
l10nKey()
java.util.Collection<java.lang.Object>
l10nParams()
static MessageException
of(java.lang.String message)
static MessageException
of(java.lang.String message, java.lang.Throwable cause)
static MessageException
ofL10n(java.lang.String l10nKey, java.lang.Object... l10nParams)
java.lang.String
toString()
-
-
-
Method Detail
-
of
public static MessageException of(java.lang.String message, java.lang.Throwable cause)
-
of
public static MessageException of(java.lang.String message)
-
ofL10n
public static MessageException ofL10n(java.lang.String l10nKey, java.lang.Object... l10nParams)
-
fillInStackTrace
public java.lang.Throwable fillInStackTrace()
Does not fill in the stack trace- Overrides:
fillInStackTrace
in classjava.lang.Throwable
- See Also:
Throwable.fillInStackTrace()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Throwable
-
l10nKey
@CheckForNull public java.lang.String l10nKey()
-
l10nParams
@CheckForNull public java.util.Collection<java.lang.Object> l10nParams()
-
-