Difference between revisions of "Dice/DiceErrorCode"

From DiceRoller Documentation
m
 
(2 intermediate revisions by the same user not shown)
Line 46: Line 46:
 
|-
 
|-
 
| InvalidMacro || The specified macro does not exist.
 
| InvalidMacro || The specified macro does not exist.
 +
|-
 +
| ParseError || Error processing the dice expression: {0} ({0} is the Message of the underlying ANTLR RecognitionException).
 +
|-
 +
| AdvantageOnlyOnce || Cannot specify advantage or disadvantage more than once.
 
|}
 
|}
  
Line 53: Line 57:
 
! Name !! Description
 
! Name !! Description
 
|-
 
|-
| {{internal}} {{method}} || [[Dice/ExtensionMethods/GetDescriptionString|GetDescriptionString]] || Retrieves the error message corresponding to the given DiceErrorCode.
+
| {{internal}} {{method}} || [[Dice/ExtensionMethods/GetDescriptionString|GetDescriptionString()]] || Retrieves the error message corresponding to the given DiceErrorCode.
 
|}
 
|}
  
 
== Remarks ==
 
== Remarks ==
 
Represents an error code that is thrown as part as an exception. The DiceException class exposes this error code, which can be used as a key in the calling application to customize error messages without needing to resort to string parsing. The default error message for any given DiceErrorCode is encapsulated via a System.ComponentModel.DescriptionAttribute attribute present on each enumeration member.
 
Represents an error code that is thrown as part as an exception. The DiceException class exposes this error code, which can be used as a key in the calling application to customize error messages without needing to resort to string parsing. The default error message for any given DiceErrorCode is encapsulated via a System.ComponentModel.DescriptionAttribute attribute present on each enumeration member.

Latest revision as of 19:46, 17 April 2017

Signifies what specific error happened when a DiceException is thrown.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public enum DiceErrorCode

Members

Member name Description
NegativeDice A negative number of dice cannot be rolled.
BadSides Dice must have between 1 and {0} sides. ({0} is the value of RollerConfig.MaxSides for the roll).
WrongSides Only the following die sizes are valid: 2, 3, 4, 6, 8, 10, 12, 20, 100, 1000, 10000.
DivideByZero Attempted to divide by 0.
RecursionDepthExceeded Maximum recursion depth of {0} exceeded. ({0} is the value of RollerConfig.MaxRecursionDepth for the roll).
NoAdvantageKeep Cannot apply advantage/disadvantage and a keep/drop expression on the same roll.
TooManySort Cannot add more than one sort expression to a roll.
TooManyDice Maximum number of dice {0} exceeded. ({0} is the value of RollerConfig.Dice for the roll).
NoSuchFunction No function named {0} is registered for the current scope. ({0} is the name of the function the user tried to call).
IncorrectArity Incorrect number of arguments passed to internal function {0}. ({0} is the name of the function).
IncorrectArgType Incorrect argument type passed to internal function {0}. ({0} is the name of the function).
InvalidSuccess When defining failures, must also define at least one success.
MixedReroll Cannot mix reroll types on a roll.
MixedExplodeType Cannot mix explosion types on a roll.
BadRerollCount The number of rerolls must be either 0 or a positive integer.
MixedExplodeComp Cannot mix explosions on max results with explosions on fixed comparisons.
InvalidMacro The specified macro does not exist.
ParseError Error processing the dice expression: {0} ({0} is the Message of the underlying ANTLR RecognitionException).
AdvantageOnlyOnce Cannot specify advantage or disadvantage more than once.

Extension Methods

Name Description
GetDescriptionString() Retrieves the error message corresponding to the given DiceErrorCode.

Remarks

Represents an error code that is thrown as part as an exception. The DiceException class exposes this error code, which can be used as a key in the calling application to customize error messages without needing to resort to string parsing. The default error message for any given DiceErrorCode is encapsulated via a System.ComponentModel.DescriptionAttribute attribute present on each enumeration member.