Better Error Messages #1112

Open
jasonwatt opened this Issue Jan 28, 2014 · 3 comments

2 participants

@jasonwatt

As i am working with this program, i keep getting random errors for files, but i have no idea which file is causing the error. The stack trace is good for development of the program but not for debugging which files are causing errors. Also there is many times a new line is not output to the console and multiple lines collide.

if would be nice to see which file was being processed when receiving the error.

In the below error i see there is a problem with file puts contents and a max file name size. This is caused by the description being put below the @package tag.

since there is only 1 file in that namespace, marked as that package, i can easily find this file, but that is only because the line is putting to the file and is show in the error output. In many cases you never get this insight.

example Error:

  5/16 [========>-------------------]  31%PHP Warning:  file_put_contents(/Users/jason/phpdocs/docs_phalcon/packages/RiccaGroup.Pagination
This class will take a large array of data and calculate if the data needs to be chunked into pages
The data passed in is being used as reference in order to cut down on memory usage
Example Use
$page->setData($records);
if ($page->check(Config::MAX.RETURN.SIZE)) {
 $cache =& .html): failed to open stream: File name too long in /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Plugin/Core/Transformer/Writer/Twig.php on line 115
PHP Stack trace:
PHP   1. {main}() /Users/jason/phpdocs/phpDocumentor2-develop/bin/phpdoc.php:0
PHP   2. phpDocumentor\Application->run() /Users/jason/phpdocs/phpDocumentor2-develop/bin/phpdoc.php:32
PHP   3. Symfony\Component\Console\Application->run() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Application.php:351
PHP   4. Symfony\Component\Console\Application->doRun() /Users/jason/phpdocs/phpDocumentor2-develop/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP   5. Symfony\Component\Console\Application->doRunCommand() /Users/jason/phpdocs/phpDocumentor2-develop/vendor/symfony/console/Symfony/Component/Console/Application.php:191
PHP   6. Symfony\Component\Console\Command\Command->run() /Users/jason/phpdocs/phpDocumentor2-develop/vendor/symfony/console/Symfony/Component/Console/Application.php:881
PHP   7. phpDocumentor\Command\Project\RunCommand->execute() /Users/jason/phpdocs/phpDocumentor2-develop/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP   8. Symfony\Component\Console\Command\Command->run() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Command/Project/RunCommand.php:268
PHP   9. phpDocumentor\Transformer\Command\Project\TransformCommand->execute() /Users/jason/phpdocs/phpDocumentor2-develop/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP  10. phpDocumentor\Console\Output\Output->writeTimedLog() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php:197
PHP  11. call_user_func_array() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Console/Output/Output.php:56
PHP  12. phpDocumentor\Transformer\Transformer->execute() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Console/Output/Output.php:56
PHP  13. phpDocumentor\Plugin\Core\Transformer\Writer\Twig->transform() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Transformer/Transformer.php:178
PHP  14. file_put_contents() /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Plugin/Core/Transformer/Writer/Twig.php:115

Suggested Error/Warning Structure

5/16 [========>-------------------]  31%
File Processed: Phalcon/Components/Pagination/Paginate.php
PHP Warning: failed to open stream: File name too long in /Users/jason/phpdocs/phpDocumentor2-develop/src/phpDocumentor/Plugin/Core/Transformer/Writer/Twig.php on line 115
PHP Stack Trace:
@mvriel
phpDocumentor member

Hello Jason,

Thank you for your suggestion. Can you inform me how the verbose output (using -v or -vv) does not help with this? That will provide a more elaborate output.

Your suggestion would be difficult at best as a error handler has no knowledge of what is processed at this moment.

@jasonwatt

yea, i can see that being an issue, the -v -vv and -vvv only show detailed information in the parsing sections, maybe have the -vv or -vvv output when looping through the processing of the data?

This section dosnt really show much more detail when verbose.

Parsing files
 40/40 [============================] 100%
Storing cache in "/Users/jason/phpdocs/docs_phalcon" .. OK
Load cache                                                         ..    0.021s
Preparing template "theme-ricca"                                   ..    0.022s
Preparing 16 transformations                                       ..    0.000s
Build "elements" index                                             ..    0.003s
Replace textual FQCNs with object aliases                          ..    0.014s
Build "packages" index                                             ..    0.005s
Collect all markers embedded in tags                               ..    0.002s
Build "namespaces" index and add namespaces to "elements"          ..    0.003s
  5/16 [========>-------------------]  31%
[2014-01-28 18:05:23] phpDocumentor.INFO: Load cache                                                         ..  [] []
Load cache                                                         .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.018s [] []
   0.018s
[2014-01-28 18:05:23] phpDocumentor.INFO: Preparing template "theme-ricca"                                   ..  [] []
Preparing template "theme-ricca"                                   .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.023s [] []
   0.023s
[2014-01-28 18:05:23] phpDocumentor.INFO: Preparing 16 transformations                                       ..  [] []
Preparing 16 transformations                                       .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.000s [] []
   0.000s
[2014-01-28 18:05:23] phpDocumentor.INFO: Build "elements" index                                             ..  [] []
Build "elements" index                                             .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.003s [] []
   0.003s
[2014-01-28 18:05:23] phpDocumentor.INFO: Replace textual FQCNs with object aliases                          ..  [] []
Replace textual FQCNs with object aliases                          .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.015s [] []
   0.015s
[2014-01-28 18:05:23] phpDocumentor.INFO: Build "packages" index                                             ..  [] []
Build "packages" index                                             .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.005s [] []
   0.005s
[2014-01-28 18:05:23] phpDocumentor.INFO: Collect all markers embedded in tags                               ..  [] []
Collect all markers embedded in tags                               .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.001s [] []
   0.001s
[2014-01-28 18:05:23] phpDocumentor.INFO: Build "namespaces" index and add namespaces to "elements"          ..  [] []
Build "namespaces" index and add namespaces to "elements"          .. [2014-01-28 18:05:23] phpDocumentor.INFO:    0.003s [] []
   0.003s
[2014-01-28 18:05:23] phpDocumentor.INFO: Transform analyzed project into artifacts                          ..  [] []
Transform analyzed project into artifacts                          .. [2014-01-28 18:05:24] 

from what i have encountered, most of the errors i have seen come from the namespaces, markers, packages and artifacts sections.

@jasonwatt

-vvv gives a bit more insight, but only to the twig parser. I can see that is fails in the indexes.packages section of my template, but nothing about which file or namespace/package.

it may not be possible, but i usually see issues with my docblocks when it gets to this point.

[2014-01-28 18:09:35] phpDocumentor.INFO: Transform analyzed project into artifacts                          ..  [] []
Transform analyzed project into artifacts                          .. [2014-01-28 18:09:35] phpDocumentor.INFO:   Applying 0 behaviours [] []
  Applying 0 behaviours
[2014-01-28 18:09:35] phpDocumentor.INFO:   Applying 16 transformations [] []
  Applying 16 transformations
[2014-01-28 18:09:35] phpDocumentor.INFO:     Writer FileIo using query "copy" on img [] []
    Writer FileIo using query "copy" on img
[2014-01-28 18:09:35] phpDocumentor.INFO:     Writer FileIo using query "copy" on css [] []
    Writer FileIo using query "copy" on css
[2014-01-28 18:09:35] phpDocumentor.INFO:     Writer FileIo using query "copy" on js [] []
    Writer FileIo using query "copy" on js
[2014-01-28 18:09:35] phpDocumentor.INFO:     Writer twig on index.html [] []
    Writer twig on index.html
[2014-01-28 18:09:36] phpDocumentor.INFO:     Writer twig using query "indexes.namespaces" on  [] []
    Writer twig using query "indexes.namespaces" on 
[2014-01-28 18:09:36] phpDocumentor.INFO:     Writer twig using query "indexes.packages" on  [] []
    Writer twig using query "indexes.packages" on 
[2014-01-28 18:09:36] phpDocumentor.WARNING: E_WARNING: file_put_contents(/Users/jason/phpdocs/docs_phalcon/packages/RiccaGroup.Pagination

if i look above i dont see much more then the missing information for the package

Parsing /Users/jason/git/phalcon/phalcon/Components/Pagination/Paginate.php
[2014-01-28 18:09:35] phpDocumentor.INFO:   Starting to parse file: /Users/jason/git/phalcon/phalcon/Components/Pagination/Paginate.php [] []
  Starting to parse file: /Users/jason/git/phalcon/phalcon/Components/Pagination/Paginate.php
[2014-01-28 18:09:35] phpDocumentor.INFO:   No summary was found for this file [] []
  No summary was found for this file
[2014-01-28 18:09:35] phpDocumentor.INFO:   No summary for property $calc [] []
  No summary for property $calc
[2014-01-28 18:09:35] phpDocumentor.INFO:   No summary for property $data [] []
  No summary for property $data
[2014-01-28 18:09:35] phpDocumentor.INFO:   No summary for property $cache [] []
  No summary for property $cache
[2014-01-28 18:09:35] phpDocumentor.INFO:   No summary for property $cachePrefix [] []
  No summary for property $cachePrefix
[2014-01-28 18:09:35] phpDocumentor.INFO:   No summary for property $cacheTimeout [] []
  No summary for property $cacheTimeout
[2014-01-28 18:09:35] phpDocumentor.INFO:   >> Memory after processing of file: 18.25 megabytes (+0 kilobytes) [] []
  >> Memory after processing of file: 18.25 megabytes (+0 kilobytes)

maybe better validation of the tags in this part of the process could help avoid errors later in the program. Not really sure of the inner workings of this whole program yet. But getting a better understanding as times goes on.

@mvriel mvriel added the Improvement label Mar 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment