com.rapidminer.operator
Class UserError

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.rapidminer.operator.OperatorException
              extended by com.rapidminer.operator.UserError
All Implemented Interfaces:
NoBugError, java.io.Serializable
Direct Known Subclasses:
MissingIOObjectException, UndefinedParameterError

public class UserError
extends OperatorException
implements NoBugError

Exception class whose instances are thrown due to a user error, for example missing files or wrong operator architecture.
In order to create a UserError, do the following:

Attention!
Although the current UserErrorMessages.properties only contain numbers, the current implementation supports arbitrary strings as identifiers. Writers of Extensions are encouraged to use Strings for separating their self defined errors from the errors defined in the core. You should prepend the namespace of the extension like this: error..error_id.short = ...

Author:
Simon Fischer, Ingo Mierswa, Sebastian Land
See Also:
Serialized Form

Constructor Summary
UserError(Operator operator, int code)
          Convenience constructor for messages with no arguments.
UserError(Operator operator, int code, java.lang.Object... arguments)
           
UserError(Operator operator, java.lang.String errorId)
          Convenience constructor for messages with no arguments.
UserError(Operator operator, java.lang.String errorId, java.lang.Object... arguments)
           
UserError(Operator operator, java.lang.Throwable cause, int code)
          Convenience constructor for messages with no arguments and cause.
UserError(Operator operator, java.lang.Throwable cause, int code, java.lang.Object... arguments)
          Creates a new UserError.
UserError(Operator operator, java.lang.Throwable cause, java.lang.String errorId)
          Convenience constructor for messages with no arguments and cause.
UserError(Operator operator, java.lang.Throwable cause, java.lang.String errorId, java.lang.Object... arguments)
           
 
Method Summary
 int getCode()
          Returns the error code.
 java.lang.String getDetails()
          Returns the error details/description.
static java.lang.String getErrorMessage(int code, java.lang.Object[] arguments)
           
static java.lang.String getErrorMessage(java.lang.String identifier, java.lang.Object[] arguments)
           
 java.lang.String getErrorName()
          Returns the error name.
 java.lang.String getHTMLMessage()
          Returns a html message.
 Operator getOperator()
           
static java.lang.String getResourceString(int code, java.lang.String key, java.lang.String deflt)
          Returns a resource message for the given error code.
static java.lang.String getResourceString(java.lang.String id, java.lang.String key, java.lang.String deflt)
          This returns a resource message of the internationalized error messages identified by an id.
 void setOperator(Operator operator)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserError

public UserError(Operator operator,
                 java.lang.Throwable cause,
                 int code,
                 java.lang.Object... arguments)
Creates a new UserError.

Parameters:
operator - The Operator in which the exception occured.
cause - The exception that caused the user error. May be null. Using this makes debugging a lot easier.
code - The error code referring to a message in the file UserErrorMessages.properties
arguments - Arguments for the short message.

UserError

public UserError(Operator operator,
                 java.lang.Throwable cause,
                 int code)
Convenience constructor for messages with no arguments and cause.


UserError

public UserError(Operator operator,
                 int code,
                 java.lang.Object... arguments)

UserError

public UserError(Operator operator,
                 int code)
Convenience constructor for messages with no arguments.


UserError

public UserError(Operator operator,
                 java.lang.Throwable cause,
                 java.lang.String errorId,
                 java.lang.Object... arguments)

UserError

public UserError(Operator operator,
                 java.lang.Throwable cause,
                 java.lang.String errorId)
Convenience constructor for messages with no arguments and cause. This constructor is in fact equivalent to the call of the above constructor but must kept for compatibility issues for existing compiled extensions.


UserError

public UserError(Operator operator,
                 java.lang.String errorId,
                 java.lang.Object... arguments)

UserError

public UserError(Operator operator,
                 java.lang.String errorId)
Convenience constructor for messages with no arguments.

Method Detail

getDetails

public java.lang.String getDetails()
Description copied from interface: NoBugError
Returns the error details/description.

Specified by:
getDetails in interface NoBugError

getErrorName

public java.lang.String getErrorName()
Description copied from interface: NoBugError
Returns the error name.

Specified by:
getErrorName in interface NoBugError

getCode

public int getCode()
Description copied from interface: NoBugError
Returns the error code.

Specified by:
getCode in interface NoBugError

getOperator

public Operator getOperator()

setOperator

public void setOperator(Operator operator)

getErrorMessage

public static java.lang.String getErrorMessage(int code,
                                               java.lang.Object[] arguments)

getErrorMessage

public static java.lang.String getErrorMessage(java.lang.String identifier,
                                               java.lang.Object[] arguments)

getResourceString

public static java.lang.String getResourceString(int code,
                                                 java.lang.String key,
                                                 java.lang.String deflt)
Returns a resource message for the given error code.

Parameters:
key - one out of "name", "short", "long"

getResourceString

public static java.lang.String getResourceString(java.lang.String id,
                                                 java.lang.String key,
                                                 java.lang.String deflt)
This returns a resource message of the internationalized error messages identified by an id. Compared to the legacy method getResourceString(int, String, String) this supports a more detailed identifier. This makes it easier to ensure extensions don't reuse already defined core errors. It is common sense to add the extensions namespace identifier as second part of the key, just after error. For example: error.rmx_web.operator.unusable = This operator {0} is unusable.

Parameters:
id - The identifier of the error. "error." will be automatically prepended-
key - The part of the error description that should be shown.
deflt - The default if no resource bundle is available.

getHTMLMessage

public java.lang.String getHTMLMessage()
Description copied from interface: NoBugError
Returns a html message.

Specified by:
getHTMLMessage in interface NoBugError


Copyright © 2001-2009 by Rapid-I