Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit757b392

Browse files
authored
Merge pull request#8 from AnswerDotAI/print-pcfg-error
Improved pcfg error
2 parents22ec3c2 +33079e4 commit757b392

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎fastcaddy/core.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def pcfg(d, path='/', method='post'):
7070
"Puts the config `d` into `path`"
7171
f=getattr(httpx,method)
7272
response=f(get_path(path),json=obj2dict(d))
73-
response.raise_for_status()
73+
try:response.raise_for_status()
74+
exceptExceptionase:
75+
e.add_note(f"Error: '{json.loads(response.text)['error']}'")
76+
raise
7477
returnresponse.textorNone
7578

7679
# %% ../nbs/00_core.ipynb 18

‎nbs/00_core.ipynb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@
214214
"\"Puts the config `d` into `path`\"\n",
215215
" f = getattr(httpx, method)\n",
216216
" response = f(get_path(path), json=obj2dict(d))\n",
217-
" response.raise_for_status()\n",
217+
" try: response.raise_for_status()\n",
218+
" except Exception as e:\n",
219+
" e.add_note(f\"Error: '{json.loads(response.text)['error']}'\")\n",
220+
" raise\n",
218221
" return response.text or None"
219222
]
220223
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp