Development

Changeset 10740

You must first sign up to be able to contribute.

Changeset 10740

Show
Ignore:
Timestamp:
08/07/08 12:36:31 (2 years ago)
Author:
fabien
Message:

[1.1, 1.2] fixed sfYaml exception line number (now starts at 1) (closes #4026)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/yaml/sfYamlParser.class.php

    r8869 r10740  
    6464      if (preg_match('#^\t+#', $this->currentLine)) 
    6565      { 
    66         throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb(), $this->currentLine)); 
     66        throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    6767      } 
    6868 
     
    107107            if (!array_key_exists($isInPlace, $this->refs)) 
    108108            { 
    109               throw new InvalidArgumentException(sprintf('Reference "%s" does not exist on line %s.', $isInPlace, $this->currentLine)); 
     109              throw new InvalidArgumentException(sprintf('Reference "%s" does not exist at line %s (%s).', $isInPlace, $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    110110            } 
    111111          } 
    112112          else 
    113113          { 
    114             throw new InvalidArgumentException(sprintf('In place substitution must point to a reference on line %s.', $this->currentLine)); 
     114            throw new InvalidArgumentException(sprintf('In place substitution must point to a reference at line %s (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    115115          } 
    116116        } 
     
    157157        } 
    158158 
    159         throw new InvalidArgumentException(sprintf('Unable to parse line %d (%s).', $this->getRealCurrentLineNb(), $this->currentLine)); 
     159        throw new InvalidArgumentException(sprintf('Unable to parse line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    160160      } 
    161161 
     
    202202    if (!$this->isCurrentLineEmpty() && 0 == $newIndent) 
    203203    { 
    204       throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb(), $this->currentLine)); 
     204      throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    205205    } 
    206206 
     
    238238      else 
    239239      { 
    240         throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb(), $this->currentLine)); 
     240        throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    241241      } 
    242242    } 
  • branches/1.2/lib/yaml/sfYamlParser.class.php

    r8869 r10740  
    6464      if (preg_match('#^\t+#', $this->currentLine)) 
    6565      { 
    66         throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb(), $this->currentLine)); 
     66        throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    6767      } 
    6868 
     
    107107            if (!array_key_exists($isInPlace, $this->refs)) 
    108108            { 
    109               throw new InvalidArgumentException(sprintf('Reference "%s" does not exist on line %s.', $isInPlace, $this->currentLine)); 
     109              throw new InvalidArgumentException(sprintf('Reference "%s" does not exist at line %s (%s).', $isInPlace, $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    110110            } 
    111111          } 
    112112          else 
    113113          { 
    114             throw new InvalidArgumentException(sprintf('In place substitution must point to a reference on line %s.', $this->currentLine)); 
     114            throw new InvalidArgumentException(sprintf('In place substitution must point to a reference at line %s (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    115115          } 
    116116        } 
     
    157157        } 
    158158 
    159         throw new InvalidArgumentException(sprintf('Unable to parse line %d (%s).', $this->getRealCurrentLineNb(), $this->currentLine)); 
     159        throw new InvalidArgumentException(sprintf('Unable to parse line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    160160      } 
    161161 
     
    202202    if (!$this->isCurrentLineEmpty() && 0 == $newIndent) 
    203203    { 
    204       throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb(), $this->currentLine)); 
     204      throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    205205    } 
    206206 
     
    238238      else 
    239239      { 
    240         throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb(), $this->currentLine)); 
     240        throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); 
    241241      } 
    242242    } 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.