add new error to catch [[floor1_1d3]] and error out correctly
This commit is contained in:
		
							parent
							
								
									ac8602f598
								
							
						
					
					
						commit
						6b198ecb47
					
				| 
						 | 
				
			
			@ -288,7 +288,9 @@ export const parseRoll = (fullCmd: string, modifiers: RollModifiers): SolvedRoll
 | 
			
		|||
    // Welp, the unthinkable happened, we hit an error
 | 
			
		||||
 | 
			
		||||
    // Split on _ for the error messages that have more info than just their name
 | 
			
		||||
    const [errorName, errorDetails] = solverError.message.split('_');
 | 
			
		||||
    const errorSplits = solverError.message.split('_');
 | 
			
		||||
    const errorName = errorSplits.shift();
 | 
			
		||||
    const errorDetails = errorSplits.join('_');
 | 
			
		||||
 | 
			
		||||
    let errorMsg = '';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -300,6 +302,9 @@ export const parseRoll = (fullCmd: string, modifiers: RollModifiers): SolvedRoll
 | 
			
		|||
      case 'YouNeedAD':
 | 
			
		||||
        errorMsg = 'Formatting Error: Missing die size and count config';
 | 
			
		||||
        break;
 | 
			
		||||
      case 'CannotParseDieCount':
 | 
			
		||||
        errorMsg = `Formatting Error: Cannot parse \`${errorDetails}\` as a number`;
 | 
			
		||||
        break;
 | 
			
		||||
      case 'DoubleSeparator':
 | 
			
		||||
        errorMsg = `Formatting Error: \`${errorDetails}\` should only be specified once per roll, remove all but one and repeat roll`;
 | 
			
		||||
        break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,6 +91,8 @@ export const roll = (rollStr: string, modifiers: RollModifiers): RollSet[] => {
 | 
			
		|||
  const rawDC = dPts.shift() || '1';
 | 
			
		||||
  if (rawDC.includes('.')) {
 | 
			
		||||
    throw new Error('WholeDieCountSizeOnly');
 | 
			
		||||
  } else if (rawDC.match(/\D/)) {
 | 
			
		||||
    throw new Error(`CannotParseDieCount_${rawDC}`);
 | 
			
		||||
  }
 | 
			
		||||
  const tempDC = rawDC.replace(/\D/g, '');
 | 
			
		||||
  // Rejoin all remaining parts
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue