<commit_before># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload

@frappe.whitelist()
def savedocs(doc, action):
	"""save / submit / update doclist"""
	try:
		doc = frappe.get_doc(json.loads(doc))
		set_local_name(doc)

		# action
		doc.docstatus = {"Save":0, "Submit": 1, "Update": 1, "Cancel": 2}[action]

		if doc.docstatus==1:
			doc.submit()
		else:
			try:
				doc.save()
			except frappe.NameError as e:
				# Duplicate Error message already shown on db_insert
				raise

		# update recent documents
		run_onload(doc)<commit_msg>fix: Remove unnecessary try catch<commit_after># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload

@frappe.whitelist()
def savedocs(doc, action):
	"""save / submit / update doclist"""
	try:
		doc = frappe.get_doc(json.loads(doc))
		set_local_name(doc)

		# action
		doc.docstatus = {"Save":0, "Submit": 1, "Update": 1, "Cancel": 2}[action]

		if doc.docstatus==1:
			doc.submit()
		else:
			doc.save()

		# update recent documents
		run_onload(doc)
{'fraction_non_alphanumeric': 0.12432432432432433, 'fraction_numerical': 0.013899613899613899, 'mean_word_length': 4.246963562753036, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3794112', 'n_tokens_mistral': 506, 'n_tokens_neox': 454, 'n_words': 126}