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

show http error code #143

Closed
smnorris opened this issue Sep 25, 2023 · 2 comments
Closed

show http error code #143

smnorris opened this issue Sep 25, 2023 · 2 comments

Comments

@smnorris
Copy link
Owner

Was the service unavailable? Or is this a bcdata issue?
First guess is that it is a service interruption, I haven't seen this error before.
But if so, this should be identified as such in the log.

 bcdata bc2pg WHSE_FOREST_TENURE.FTEN_ROAD_SECTION_LINES_SVW
 Traceback (most recent call last):
   File "/home/snorris/.local/lib/python3.10/site-packages/tenacity/__init__.py", line 382,
 in __call__
     result = fn(*args, **kwargs)
   File "/home/snorris/.local/lib/python3.10/site-packages/bcdata/wfs.py", line 144, in _re
quest_count
     return count
 UnboundLocalError: local variable 'count' referenced before assignment
 The above exception was the direct cause of the following exception:
 Traceback (most recent call last):
   File "/home/snorris/.local/bin/bcdata", line 8, in <module>
     sys.exit(cli())
   File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
     return self.main(*args, **kwargs)
   File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
     rv = self.invoke(ctx)
   File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
     return _process_result(sub_ctx.command.invoke(sub_ctx))
   File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
     return ctx.invoke(self.callback, **ctx.params)
   File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
     return __callback(*args, **kwargs)
   File "/home/snorris/.local/lib/python3.10/site-packages/bcdata/cli.py", line 378, in bc2
pg
     out_table = bcdata.bc2pg(
   File "/home/snorris/.local/lib/python3.10/site-packages/bcdata/bc2pg.py", line 73, in bc
2pg
     urls = bcdata.define_requests(
   File "/home/snorris/.local/lib/python3.10/site-packages/bcdata/wfs.py", line 440, in def
ine_requests
     return WFS.define_requests(
   File "/home/snorris/.local/lib/python3.10/site-packages/bcdata/wfs.py", line 274, in def
ine_requests
     count = self.get_count(
   File "/home/snorris/.local/lib/python3.10/site-packages/bcdata/wfs.py", line 192, in get
_count
     count = self._request_count(
   File "/home/snorris/.local/lib/python3.10/site-packages/tenacity/__init__.py", line 289,
 in wrapped_f
     return self(f, *args, **kw)
   File "/home/snorris/.local/lib/python3.10/site-packages/tenacity/__init__.py", line 379,
 in __call__
     do = self.iter(retry_state=retry_state)
   File "/home/snorris/.local/lib/python3.10/site-packages/tenacity/__init__.py", line 326,
 in iter
     raise retry_exc from fut.exception()
 tenacity.RetryError: RetryError[<Future at 0x7ff4db2ca170 state=finished raised UnboundLoc
alError>]
@smnorris
Copy link
Owner Author

Errors should be pulled out of the response header (only visible currently if using the verbose option -v)

@smnorris smnorris changed the title retry error show http error code when raising retry errors Sep 28, 2023
@smnorris smnorris changed the title show http error code when raising retry errors show http error code Oct 11, 2023
@smnorris
Copy link
Owner Author

Other error codes are possible. If you try and sort by a field that is not present in the table, the service will return a 400.
Probably best to log all http status codes at INFO level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant