Closed tomasrelai closed 3 years ago
(Same for creating a database that already exists using overwrite=False
, etc.)
In the examples (but not all) we do this:
def show_error(e: HTTPError) -> None:
r = e.read()
if len(r) > 0:
rsp = json.loads(r)
print(f"Got error, status: {e.status}")
print(json.dumps(rsp, indent=2))
else:
print("There is no descriptive error message, got:", e)
def run(profile: str):
cfg = config.read(profile=profile)
ctx = api.Context(**cfg)
try:
rsp = api.list_databases(ctx)
print(json.dumps(rsp, indent=2))
except HTTPError as e:
show_error(e)
We could add this to all the examples and mention it in the docs.
renamed local show_error to http_error, moved to railib.show, and added handlers to all examples so they will produce meaningful outputs from the response payload.
Note: This issue has been migrated to https://relationalai.atlassian.net/browse/RAI-3780.
This link is only accessible to employees of RelationalAI.
Cloning into an existing database, say, gives an HTTP error. This is a little obscure, wondering if we should give higher-level errors. This would help narrow down the error --- maybe the target already exists, or maybe the source DB does not exist, etc.