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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
67631098
Commit
67631098
authored
Nov 11, 2021
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: refactor bootloader error message
parent
7260fb1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
55 deletions
+46
-55
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_presentation_js.js
...page_module/gadget_officejs_bootloader_presentation_js.js
+44
-53
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_presentation_js.xml
...age_module/gadget_officejs_bootloader_presentation_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_presentation_js.js
View file @
67631098
...
...
@@ -3,64 +3,65 @@
(
function
(
window
,
rJS
,
RSVP
,
Event
,
XMLHttpRequest
)
{
"
use strict
"
;
function
displayErrorContent
(
original_error
)
{
function
displayErrorContent
(
error_div
,
original_error
)
{
var
error_list
=
[
original_error
],
i
,
error
,
error_text
=
""
;
line
=
"
-----------------------------------------------
"
,
addErrorMessage
=
function
(
parent_div
,
content
)
{
var
sub_error_div
=
document
.
createElement
(
'
div
'
);
sub_error_div
.
classList
.
add
(
'
error-message
'
);
sub_error_div
.
textContent
=
content
;
parent_div
.
appendChild
(
sub_error_div
);
};
error_div
.
textContent
=
line
;
addErrorMessage
(
error_div
,
"
ERROR
"
);
if
(
original_error
.
message
)
{
addErrorMessage
(
error_div
,
original_error
.
message
);
}
if
(
original_error
.
currentTarget
)
{
addErrorMessage
(
error_div
,
"
URL:
"
+
original_error
.
currentTarget
.
responseURL
);
}
addErrorMessage
(
error_div
,
line
);
addErrorMessage
(
error_div
,
"
FULL ERROR INFORMATION:
"
);
error_list
.
push
(
new
Error
(
'
stopping ERP5JS
'
));
for
(
i
=
0
;
i
<
error_list
.
length
;
i
+=
1
)
{
error
=
error_list
[
i
];
if
(
error
instanceof
Event
)
{
error
=
{
string
:
error
.
toString
(),
message
:
error
.
message
,
type
:
error
.
type
,
target
:
error
.
target
};
if
(
error
instanceof
XMLHttpRequest
)
{
addErrorMessage
(
error_div
,
"
- readyState:
"
+
error
.
readyState
);
addErrorMessage
(
error_div
,
"
- status:
"
+
error
.
status
);
addErrorMessage
(
error_div
,
"
- statusText:
"
+
error
.
statusText
);
addErrorMessage
(
error_div
,
"
- response:
"
+
error
.
response
);
addErrorMessage
(
error_div
,
"
- responseUrl:
"
+
error
.
responseUrl
);
addErrorMessage
(
error_div
,
"
- response_headers:
"
+
error
.
getAllResponseHeaders
());
}
else
if
(
error
instanceof
Event
)
{
addErrorMessage
(
error_div
,
"
- type:
"
+
error
.
type
);
addErrorMessage
(
error_div
,
"
- target:
"
+
error
.
target
);
if
(
error
.
target
!==
undefined
)
{
error_list
.
splice
(
i
+
1
,
0
,
error
.
target
);
}
}
if
(
error
instanceof
XMLHttpRequest
)
{
error
=
{
message
:
error
.
toString
(),
readyState
:
error
.
readyState
,
status
:
error
.
status
,
statusText
:
error
.
statusText
,
response
:
error
.
response
,
responseUrl
:
error
.
responseUrl
,
response_headers
:
error
.
getAllResponseHeaders
()
};
}
if
(
error
.
constructor
===
Array
||
error
.
constructor
===
String
||
error
.
constructor
===
Object
)
{
try
{
error
=
JSON
.
stringify
(
error
);
}
catch
(
ignore
)
{
addErrorMessage
(
error_div
,
"
- Full error:
"
+
JSON
.
stringify
(
error
));
}
if
(
error
.
message
)
{
addErrorMessage
(
error_div
,
"
- message:
"
+
error
.
message
);
}
error_text
+=
error
.
message
||
error
;
error_text
+=
'
\n
'
;
if
(
error
.
fileName
!==
undefined
)
{
error_text
+=
'
File:
'
+
error
.
fileName
+
'
:
'
+
error
.
lineNumber
+
'
\n
'
;
addErrorMessage
(
error_div
,
"
- file:
"
+
error
.
fileName
+
'
:
'
+
error
.
lineNumber
);
}
if
(
error
.
stack
!==
undefined
)
{
error_text
+=
'
Stack:
'
+
error
.
stack
+
'
\n
'
;
}
error_text
+=
'
---
\n
'
;
}
return
error_text
;
addErrorMessage
(
error_div
,
line
);
addErrorMessage
(
error_div
,
"
STACK
"
);
addErrorMessage
(
error_div
,
error
.
stack
);
}
function
displayError
(
error
)
{
if
(
error
instanceof
RSVP
.
CancellationError
)
{
return
"
RSVP cancelation error
"
;
addErrorMessage
(
error_div
,
line
);
}
return
displayErrorContent
(
error
);
}
rJS
(
window
)
...
...
@@ -68,7 +69,7 @@
return
this
.
changeState
(
options
);
})
.
onStateChange
(
function
(
modification_dict
)
{
var
skip_link
,
error_div
,
app_name_div
,
message
,
error_text
,
var
skip_link
,
error_div
,
app_name_div
,
gadget
=
this
;
if
(
modification_dict
.
app_name
)
{
app_name_div
=
gadget
.
element
.
querySelector
(
"
.app-name
"
);
...
...
@@ -81,21 +82,11 @@
}
if
(
modification_dict
.
error
)
{
error_div
=
gadget
.
element
.
querySelector
(
"
.error-message
"
);
message
=
"
Last Error:
"
;
error_text
=
displayError
(
gadget
.
state
.
error
);
if
(
gadget
.
state
.
error
.
message
)
{
message
+=
gadget
.
state
.
error
.
message
;
}
else
{
message
+=
JSON
.
stringify
(
gadget
.
state
.
error
);
}
if
(
modification_dict
.
error
.
currentTarget
)
{
message
+=
"
- URL:
"
+
modification_dict
.
error
.
currentTarget
.
responseURL
;
if
(
gadget
.
state
.
error
instanceof
RSVP
.
CancellationError
)
{
error_div
.
textContent
=
"
RSVP cancelation error
"
;
}
else
{
message
+=
"
"
+
modification_dict
.
error
;
displayErrorContent
(
error_div
,
gadget
.
state
.
error
)
;
}
message
+=
"
- FULL ERROR:
"
+
error_text
;
error_div
.
textContent
=
message
;
}
if
(
modification_dict
.
redirect_url
)
{
skip_link
=
gadget
.
element
.
querySelector
(
"
.skip-link
"
);
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_presentation_js.xml
View file @
67631098
...
...
@@ -240,7 +240,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
77.20600.46420.51012
</string>
</value>
<value>
<string>
9
96.6524.39016.52480
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>
1
564070032.56
</float>
<float>
1
636726847.78
</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