Skip to main content

Posts

Showing posts from January, 2021

Handling JavaScript Errors - Part 2

In my previous blogpost, I have explained about JavaScript errors and how we can handle them in general and how we can handle them at application level. If you have not read it yet, you can read it here . In this blogpost, I will explain an approach to log JavaScript errors to a database table.  error event on window object provides lot of information. I found below information is useful for debugging and worth logging into DB. event.message : JavaScript error message event.filename : If source of the error is from a JavaScript file, then this will give full path of JavaScript file. If error is from inline JavaScript code written in APEX page, then this will give full APEX page URL including APEX session. event.lineno : Line number where error has occurred. Depending on event.filename, it could refer to line number from JavaScript file or from generated HTML page. event.colno : Column number where error has occurred. It should be read along with event.lineno . event.error.stack : Cal

Handling JavaScript Errors - Part 1

Before APEX version 5.0, there were only handful of documented JavaScript (JS) functions in APEX. Now, there are several JavaScript namespaces and hundreds of functions and methods available in Oracle APEX. From APEX 18.1, separate documentation section "JavaScript API Reference" is also added for JavaScript. So, it's evident that usage of JavaScript in APEX is increasing every day and with every release.  But, how are you handling JavaScript errors in your APEX applications? For server-side errors, we can use EXCEPTION block and we can also define "Error Handling Function" at application level. What about JavaScript code? Can we do something similar for JavaScript errors? In this blog, I am going to briefly explain about JavaScript errors and how we can handle them in general and how we can handle them at application level. Introduction Browsers have JavaScript engine inside them. Mozilla's TraceMonkey, Google's v8 are examples for JavaScript engines.