org.sonar.api.utils
Class MessageException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.sonar.api.utils.MessageException
All Implemented Interfaces:
Serializable

public class MessageException
extends RuntimeException

Runtime exception for "functional" error. It aims to be displayed to end-users, without any technical information like stack traces. It requires sonar-runner 2.4. Previous versions log stack trace.

Note that by design Maven still logs the stack trace when the option -e is set.

Message should be clear and complete. Keep in mind that context is not added to the exception. Names of processed resource and decorator are for example not automatically added when throwing MessageException from Decorator.

Since:
3.7.1
See Also:
Serialized Form

Method Summary
 Throwable fillInStackTrace()
          Does not fill in the stack trace
 String l10nKey()
           
 Collection<Object> l10nParams()
           
static MessageException of(String message)
           
static MessageException ofL10n(String l10nKey, Object... l10nParams)
           
 String toString()
           
 
Methods inherited from class java.lang.Throwable
getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

of

public static MessageException of(String message)

ofL10n

public static MessageException ofL10n(String l10nKey,
                                      Object... l10nParams)

fillInStackTrace

public Throwable fillInStackTrace()
Does not fill in the stack trace

Overrides:
fillInStackTrace in class Throwable
See Also:
Throwable.fillInStackTrace()

toString

public String toString()
Overrides:
toString in class Throwable

l10nKey

@CheckForNull
public String l10nKey()

l10nParams

@CheckForNull
public Collection<Object> l10nParams()


Copyright © 2009–2015 SonarSource. All rights reserved.