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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
4fd705df
Commit
4fd705df
authored
Sep 30, 2014
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent service errors to crash the application.
parent
d66cf79a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
28 deletions
+36
-28
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
...i/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
+36
-28
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
View file @
4fd705df
...
@@ -149,6 +149,35 @@
...
@@ -149,6 +149,35 @@
return all_result[0];\n
return all_result[0];\n
});\n
});\n
}\n
}\n
\n
function displayError(gadget, error) {\n
// Do not break the application in case of errors.\n
// Display it to the user for now, and allow user to go back to the frontpage\n
var error_text = "";\n
if (error.status === 401) {\n
// Redirect to the login view\n
return gadget.aq_pleasePublishMyState({page: "login"})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
}\n
if (error instanceof RSVP.CancellationError) {\n
return;\n
}\n
\n
if (error instanceof XMLHttpRequest) {\n
error_text = error.toString() + " " +\n
error.status + " " +\n
error.statusText;\n
} else if (error instanceof Error) {\n
error_text = error.toString();\n
} else {\n
error_text = JSON.stringify(error);\n
}\n
\n
console.error(error);\n
console.error(error.stack);\n
// XXX Improve error rendering\n
gadget.props.article.textContent = "Error: " + error_text;\n
}\n
\n
\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
// Gadget behaviour\n
// Gadget behaviour\n
...
@@ -248,6 +277,10 @@
...
@@ -248,6 +277,10 @@
.allowPublicAcquisition("renderPageHeader", function (param_list) {\n
.allowPublicAcquisition("renderPageHeader", function (param_list) {\n
this.props.header_argument_list = param_list;\n
this.props.header_argument_list = param_list;\n
})\n
})\n
\n
.allowPublicAcquisition(\'reportServiceError\', function (param_list) {\n
return displayError(this, param_list[0]);\n
})\n
\n
\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
// declared methods\n
...
@@ -318,33 +351,8 @@
...
@@ -318,33 +351,8 @@
})\n
})\n
\n
\n
.push(undefined, function (error) {\n
.push(undefined, function (error) {\n
// Do not break the application in case of errors.\n
// Display it to the user for now, and allow user to go back to the frontpage\n
var error_text = "";\n
if (error.status === 401) {\n
// Redirect to the login view\n
return gadget.aq_pleasePublishMyState({page: "login"})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
}\n
if (error instanceof RSVP.CancellationError) {\n
return;\n
}\n
\n
if (error instanceof XMLHttpRequest) {\n
error_text = error.toString() + " " +\n
error.status + " " +\n
error.statusText;\n
} else if (error instanceof Error) {\n
error_text = error.toString();\n
} else {\n
error_text = JSON.stringify(error);\n
}\n
\n
console.error(error);\n
console.error(error.stack);\n
// XXX Improve error rendering\n
gadget.props.article.textContent = "Error: " + error_text;\n
$.mobile.loading(\'hide\');\n
$.mobile.loading(\'hide\');\n
return displayError(gadget, error);\n
});\n
});\n
});\n
});\n
\n
\n
...
@@ -485,7 +493,7 @@
...
@@ -485,7 +493,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
937.5
8323.33142.30617
</string>
</value>
<value>
<string>
937.5
9906.57015.45841
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -503,7 +511,7 @@
...
@@ -503,7 +511,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14120
00231.85
</float>
<float>
14120
80420.18
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</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