Frappe Technologies
Screenshot 2023-10-25 at 10.48.41 PM.png
Better Error Logging with Frappe
Bad Error Handling is one of the toughest problems in software architecture and a reason for most breakdowns
author

By

Rushabh Mehta

·

7 October 2016

·

2

min read

Software code is usually designed to run in a certain way, with certain inputs. If the code does not receive correct input (or any input!) then it fails. For example a wrong Customer ID will cause your Invoice to fail.

Most software is designed to handle such cases, but this is not as easy as it sounds. For example detecting a bad email id is a hard problem.

When we build applications with a user interface, these bad inputs are easy to identify and protect the user against. Also the result of a bad error is immediately visible to the user or tester who reports it back to the developer.

But when we design systems that talk to other systems, these errors often go un-noticed and happen at odd times, when there is no user to observe or report it. Hence when dealing with integrations, error handling becomes very critical.

In Frappe, so far we had a mixed system for Error Handling. There was the Scheduler Log that got updated when something failed, and Max Morias' Error Snapshot that detected errors at a much deeper level. For a developer to explicitly log errors, there was no simple mechanism.

Error Log

So we are now introducing the Error Log which is a renamed Scheduler Log. This is the default place for a software to report when something fails.

To call it, from code you can just write: frappe.log_error(frappe.get_traceback(), 'payment failed')

This will immediately log it into the Error Log table (which is MyISAM type, so you need not commit) and can be viewed by the user or administrator.

Error Log

Bad Error Handling is one of the biggest reasons for software to fail and as ERPNext keeps building more integrations, it is important to improve the error handling code!

Published by

Rushabh Mehta

on

7 October 2016
3

Share

Add your comment

Success!

Error

Comments

V
Victor

· 

May 25, 2023

Hi Suad. In the global search on top of ERPNext screen, you can type "Error Log List" to get to the error log page shown in this article. Hope it helps!

S
Suad

· 

November 26, 2022

I just can not understand why in such a details article we can not see how to get to this menu point. I can't see any form, menu point in my frappe - erpnext site. So how should we get to the screen you are showing. Please think next time that there are plenty people trying to learn ERPNext and this is not as easy to read your article.

Thank you Suad

Abhishek Balam

· 

April 27, 2020
Please change Content Type to Markdown.
Links and code snippets not displaying properly...

Discussion

image7f7d4e.png

Paul Mugambi

·

3 days

ago

Beautiful read, and an insight into an individual I respect and have learned a lot from. Am inspired to trust the process and never give up.

image4c43d6.png

Anna Dane

·

5 days

ago

I must say this is a really amazing post, and for some of my friends who provide Best British Assignment Help, I must recommend this post to them.

Add your comment

Comment