podhmo / dictknife

armyknife of handling dict object
MIT License
19 stars 4 forks source link

jsonknife resolver, gentle error message #109

Open podhmo opened 5 years ago

podhmo commented 5 years ago

currently

Traceback (most recent call last):
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/accessor.py", line 54, in access_by_json_pointer
    return accessor.access(doc, path)
  File "$HOME/venvs/my/dictknife/dictknife/accessing.py", line 19, in access
    d = d[name]
KeyError: 'components'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/bundler.py", line 57, in scan
    item = self.accessor.access(sd["$ref"])
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/accessor.py", line 83, in access
    return self._access(subresolver, pointer)
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/accessor.py", line 105, in _access
    data = super()._access(subresolver, pointer)
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/accessor.py", line 86, in _access
    return access_by_json_pointer(subresolver.doc, pointer, accessor=self.accessor)
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/accessor.py", line 56, in access_by_json_pointer
    raise KeyError(query)
KeyError: '/components/schemas/User'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "2to3.py", line 114, in <module>
    main()
  File "2to3.py", line 110, in main
    run(**vars(args))
  File "2to3.py", line 94, in run
    with m.migrate(dry_run=dry_run, keep=True, savedir=savedir) as u:
  File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "$HOME/venvs/my/dictknife/dictknife/swaggerknife/migration.py", line 134, in _migrate
    with self._migrate(doc=doc, where=where, savedir=savedir) as u:
  File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "$HOME/venvs/my/dictknife/dictknife/swaggerknife/migration.py", line 74, in _migrate
    self._prepare(doc=doc, where=where)
  File "$HOME/venvs/my/dictknife/dictknife/swaggerknife/migration.py", line 50, in _prepare
    scanner.scan(self.resolver.doc)
  File "$HOME/venvs/my/dictknife/dictknife/jsonknife/bundler.py", line 73, in scan
    "{} (where={})".format(e, self.accessor.resolver.name)
RuntimeError: '/components/schemas/User' (where=$HOME/venvs/my/individual-sandbox/daily/20190218/example_openapi/src/more2.0.yaml)