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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
erp5
Commits
ec4b1276
Commit
ec4b1276
authored
Jul 03, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: better error catching in local controller gadget
parent
5400a394
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
...teItem/web_page_module/gadget_officejs_common_utils_js.js
+5
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
...le/gadget_officejs_controller_page_local_controller_js.js
+11
-5
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_utils_js.js
View file @
ec4b1276
...
...
@@ -191,7 +191,8 @@
form_definition
,
query_type
,
query_parent
,
query_reference
;
query_reference
,
error
;
query_reference
=
new
SimpleQuery
({
key
:
"
reference
"
,
operator
:
""
,
...
...
@@ -218,7 +219,9 @@
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
data
)
{
if
(
data
.
data
.
rows
.
length
===
0
)
{
throw
"
Can not find action '
"
+
action_reference
+
"
' for portal type '
"
+
portal_type
+
"
'
"
;
error
=
new
Error
(
"
Can not find action '
"
+
action_reference
+
"
' for portal type '
"
+
portal_type
+
"
'
"
);
error
.
status_code
=
400
;
throw
error
;
}
return
gadget
.
jio_get
(
data
.
data
.
rows
[
0
].
id
);
})
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
View file @
ec4b1276
...
...
@@ -53,9 +53,12 @@
if
(
jio_document
.
portal_type
===
undefined
)
{
throw
new
Error
(
'
Can not display document:
'
+
options
.
jio_key
);
}
},
function
()
{})
.
push
(
function
()
{
return
gadget
.
getSetting
(
'
parent_portal_type
'
);
},
function
(
error
)
{
// instaceof error is Object, so use status_code and undefined jio_key
if
(
error
.
status_code
===
400
&&
!
options
.
jio_key
)
{
return
gadget
.
getSetting
(
'
parent_portal_type
'
);
}
throw
error
;
})
.
push
(
function
(
parent_portal_type
)
{
if
(
jio_document
)
{
...
...
@@ -70,8 +73,11 @@
})
.
push
(
function
(
result
)
{
return
result
;
},
function
()
{
return
gadget_utils
.
getFormDefinition
(
portal_type
,
default_view
);
},
function
(
error
)
{
if
(
error
.
status_code
===
400
)
{
return
gadget_utils
.
getFormDefinition
(
portal_type
,
default_view
);
}
throw
error
;
})
.
push
(
function
(
result
)
{
form_definition
=
result
;
...
...
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