Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error messages in sample add form #1970

Merged
merged 3 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.2.0 (unreleased)
------------------

- #1970 Better error messages in sample add form
- #1960 AddressField and AddressWidget with React component for DX types
- #1968 Fix default roles for client field in samples
- #1962 Allow to create worksheet from samples
Expand Down
4 changes: 2 additions & 2 deletions src/bika/lims/browser/analysisrequest/add2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,9 +1647,9 @@ def ajax_submit(self):
self.request,
record,
)
except (KeyError, RuntimeError) as e:
except Exception as e:
actions.resume()
errors["message"] = e.message
errors["message"] = str(e)
return {"errors": errors}
# We keep the title to check if AR is newly created
# and UID to print stickers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@
if (data['errors']) {
msg = data.errors.message;
if (msg !== "") {
msg = msg + "<br/>";
msg = _t("Sorry, an error occured 🙈<p class='code'>" + msg + "</p>");
}
for (fieldname in data.errors.fielderrors) {
field = $("#" + fieldname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ class window.AnalysisRequestAdd
if data['errors']
msg = data.errors.message
if msg isnt ""
msg = "#{msg}<br/>"
msg = _t("Sorry, an error occured 🙈<p class='code'>#{msg}</p>")

for fieldname of data.errors.fielderrors
field = $("##{fieldname}")
Expand Down