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
0
Merge Requests
0
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
Tomáš Peterka
erp5
Commits
363e6e07
Commit
363e6e07
authored
Jul 03, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Harden error handling in editable form
parent
45969c42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
...b_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
+12
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
..._page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
View file @
363e6e07
...
...
@@ -158,6 +158,12 @@
error_text
=
'
Input data has errors
'
;
}
else
if
(
error
.
target
.
status
===
403
)
{
error_text
=
'
You do not have the permissions to edit the object
'
;
}
else
if
(
error
.
target
.
status
===
0
&&
error
.
total
===
0
)
{
// backend cannot be reached and no data is being transfered
error_text
=
'
Document was not saved! Resubmit when you are online or the document accessible
'
;
}
else
{
// display "unknown error" rather than destroying user's form data (throwing an error)
error_text
=
'
Encountered an unknown error. Try to resubmit
'
;
}
if
(
error_text
!==
undefined
)
{
return
form_gadget
.
notifySubmitted
()
...
...
@@ -168,16 +174,21 @@
return
form_gadget
.
notifyChange
(
message
+
'
.
'
);
})
.
push
(
function
()
{
// when the server-side validation returns the error description
if
(
error
.
target
.
responseType
===
"
blob
"
)
{
return
jIO
.
util
.
readBlobAsText
(
error
.
target
.
response
);
}
// otherwise return (most-likely) textual response of the server
return
{
target
:
{
result
:
error
.
target
.
response
}};
})
.
push
(
function
(
event
)
{
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
event
.
target
.
result
));
});
})
// most likely a JSON parse error because of invalid response which we will quietly ignore
.
fail
(
function
()
{});
}
}
// throwing an error is the last desperate option
throw
error
;
});
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
View file @
363e6e07
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
58.31331.40640.10291
</string>
</value>
<value>
<string>
9
60.31544.14430.63812
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
149
1385195
.38
</float>
<float>
149
9089561
.38
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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