gnucash-web
gnucash-web copied to clipboard
Improve error handling on invalid transactions
Deployed in Docker running on Ubuntu Server 20.04 connected to Postgres 15 using the sample docker-compose in the repo. When I try to navigate to /book/accounts/Assets/Current+Assets/Checking+Account
I get an "Internal Server Error", checking the docker logs I see the below error.
app_1 | [2023-12-13 05:42:29,098] ERROR in app: Exception on /book/accounts/Assets/Current+Assets/Checking+Account [GET]
app_1 | Traceback (most recent call last):
app_1 | File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
app_1 | response = self.full_dispatch_request()
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
app_1 | rv = self.handle_user_exception(e)
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
app_1 | rv = self.dispatch_request()
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
app_1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/srv/gnucash_web/auth.py", line 62, in inner
app_1 | return func(*args, **kwargs)
app_1 | ^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/srv/gnucash_web/book.py", line 94, in show_account
app_1 | return render_template(
app_1 | ^^^^^^^^^^^^^^^^
app_1 | File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
app_1 | return _render(app, template, context)
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 130, in _render
app_1 | rv = template.render(context)
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
app_1 | self.environment.handle_exception()
app_1 | File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
app_1 | raise rewrite_traceback_stack(source=source)
app_1 | File "/srv/gnucash_web/templates/account.j2", line 2, in top-level template code
app_1 | {% from 'forms.j2' import transaction_form %}
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/srv/gnucash_web/templates/base.j2", line 56, in top-level template code
app_1 | {% block content required %}{% endblock %}
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/srv/gnucash_web/templates/account.j2", line 77, in block 'content'
app_1 | {% include 'transaction.j2' %}
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | File "/srv/gnucash_web/templates/transaction.j2", line 100, in top-level template code
app_1 | data-bs-transaction-sign="{{ split.value / split.value|abs }}"
app_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
app_1 | decimal.InvalidOperation: [<class 'decimal.DivisionUndefined'>]