Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
7475f107
Commit
7475f107
authored
Jul 01, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_jio_connector: properly raise errors for NotFound and BadRequest
parent
46a81380
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
bt5/erp5_jio_connector/DocumentTemplateItem/portal_components/document.erp5.JioApiConnector.py
...teItem/portal_components/document.erp5.JioApiConnector.py
+9
-0
No files found.
bt5/erp5_jio_connector/DocumentTemplateItem/portal_components/document.erp5.JioApiConnector.py
View file @
7475f107
...
...
@@ -30,6 +30,8 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
zExceptions
import
BadRequest
,
NotFound
import
requests
class
JioApiConnector
(
XMLObject
):
...
...
@@ -64,6 +66,13 @@ class JioApiConnector(XMLObject):
except
:
raise
Exception
(
"Error when sending to API ({}): API returned invalid JSON"
.
format
(
r
.
status_code
))
if
r
.
status_code
==
400
:
err
=
BadRequest
(
result
[
"name"
])
err
.
detail
=
result
[
"message"
]
raise
err
if
r
.
status_code
==
404
:
raise
NotFound
(
result
[
"message"
])
raise
Exception
(
"Error when sending to API ({}): {}"
.
format
(
r
.
status_code
,
result
[
"message"
]))
def
getFromApi
(
self
,
request_dict
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment