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.RuntimeExceptionRuntime 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 throwingMessageExceptionfromorg.sonar.api.batch.Decorator.- Since:
- 3.7.1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMessageException(java.lang.String s)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ThrowablefillInStackTrace()Does not fill in the stack tracejava.lang.Stringl10nKey()java.util.Collection<java.lang.Object>l10nParams()static MessageExceptionof(java.lang.String message)static MessageExceptionof(java.lang.String message, java.lang.Throwable cause)static MessageExceptionofL10n(java.lang.String l10nKey, java.lang.Object... l10nParams)java.lang.StringtoString()
-
-
-
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:
fillInStackTracein classjava.lang.Throwable- See Also:
Throwable.fillInStackTrace()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Throwable
-
l10nKey
@CheckForNull public java.lang.String l10nKey()
-
l10nParams
@CheckForNull public java.util.Collection<java.lang.Object> l10nParams()
-
-