Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imprecise exception display #14

Open
DoomTaper opened this issue Jun 2, 2016 · 3 comments
Open

Imprecise exception display #14

DoomTaper opened this issue Jun 2, 2016 · 3 comments

Comments

@DoomTaper
Copy link
Contributor

Although ptp handles precise exceptions but it doesn't show that
e.g.
ptp=PTP('w3af')
ptp.parse('some/random/non-existing/directory')

Below error is shown
Traceback (most recent call last): File "testing.py", line 3, in <module> c = ptp.parse('/root/Desktop/w3af_repo') File "/root/Desktop/ptp/ptp/ptp.py", line 121, in parse raise NotSupportedToolError('This tool is not supported by PTP.') ptp.libptp.exceptions.NotSupportedToolError: This tool is not supported by PTP.

while it should display why the error occurred like above it should show directory doesn't exists or something related to it, helps in correcting error for user itself.

@DePierre
Copy link
Contributor

@DoomTaper how about the following errors?

>>> from ptp import PTP
>>> p = PTP('w3af')
>>> p.parse()
No parser matched `ToolParser((), {})`

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ptp/ptp.py", line 122, in parse
    raise NotSupportedToolError('This tool is not supported by PTP.')
ptp.libptp.exceptions.NotSupportedToolError: This tool is not supported by PTP.
>>> p.parse('foo/bar')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ptp/ptp.py", line 119, in parse
    self._init_parser(*args, **kwargs)
  File "ptp/ptp.py", line 94, in _init_parser
    if parser.is_mine(*args, **kwargs):
  File "ptp/tools/w3af/parser.py", line 66, in is_mine
    stream = cls.handle_file(pathname, filename, first=first)
  File "ptp/libptp/parser.py", line 178, in handle_file
    raise IOError("Report matching '%s' cannot be found." % os.path.join(pathname, filename))
IOError: Report matching 'foo/bar/*.xml' cannot be found.

@DoomTaper
Copy link
Contributor Author

DoomTaper commented Jun 20, 2016

@DePierre its exactly what I was looking for :)

@DePierre
Copy link
Contributor

DePierre commented Jan 15, 2017

Re-opened via 9760a1f#diff-329faea9e46f3af8da40d4c54f4b00ffR106

I am not sure how to properly handle this issue. It would be easy in PTP to check that pathname is an existing directory for instance. However, pathname is supposed to be only visible from the parsers, since a parse may not be using any path (might be a URL for instance in the future).

It might be more accurate to check if pathname exists in the libptp.parser file.

@DePierre DePierre reopened this Jan 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants