{"id":713,"date":"2024-08-12T07:26:07","date_gmt":"2024-08-12T07:26:07","guid":{"rendered":"https:\/\/razvanvancea.ro\/blog\/?p=713"},"modified":"2026-05-24T05:15:50","modified_gmt":"2026-05-24T05:15:50","slug":"how-to-add-error-handler-to-log-errors-in-k6","status":"publish","type":"post","link":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/","title":{"rendered":"How to add Error Handler to log errors in k6 load tests"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"713\" class=\"elementor elementor-713\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-67f7987 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"67f7987\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-35e41e4\" data-id=\"35e41e4\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-094a277 elementor-widget elementor-widget-text-editor\" data-id=\"094a277\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Apparently, when you run k6 load tests and some of them fails, by default you don&#8217;t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need to implement an Error Handler class in your project.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-dc15d50 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"dc15d50\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-eed9597\" data-id=\"eed9597\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b4b0c2e elementor-widget elementor-widget-image\" data-id=\"b4b0c2e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"640\" height=\"176\" src=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-1024x281.png\" class=\"attachment-large size-large wp-image-714\" alt=\"error-k6-no-actual\" srcset=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-1024x281.png 1024w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-300x82.png 300w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-768x210.png 768w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-850x233.png 850w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-24x7.png 24w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-36x10.png 36w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21-48x13.png 48w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.07.21.png 1080w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8e61653 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8e61653\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5f7d11f\" data-id=\"5f7d11f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a964f9a elementor-widget elementor-widget-text-editor\" data-id=\"a964f9a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>For example, in the above image you can&#8217;t know why the test failed. The status code was not expected 200, but what was the actual status? Personally, I consider this information mandatory for the debugging process.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7aa7b30 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7aa7b30\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7c0c74a\" data-id=\"7c0c74a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-703dcc8 elementor-widget elementor-widget-heading\" data-id=\"703dcc8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">The solution<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9308511 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9308511\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4cb1816\" data-id=\"4cb1816\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-578153e elementor-widget elementor-widget-text-editor\" data-id=\"578153e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In the project structure, I usually like to create a &#8216;lib&#8217; folder with a new &#8216;ErrorHandler.js&#8217; file that contains the following<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2c42632 elementor-widget elementor-widget-image\" data-id=\"2c42632\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"640\" height=\"398\" src=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-1024x637.png\" class=\"attachment-large size-large wp-image-715\" alt=\"\" srcset=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-1024x637.png 1024w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-300x187.png 300w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-768x478.png 768w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-1536x956.png 1536w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-2048x1274.png 2048w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-850x529.png 850w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-24x15.png 24w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-36x22.png 36w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.13.11-48x30.png 48w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a1db4e5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a1db4e5\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-423787f\" data-id=\"423787f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-76d0fc7 elementor-widget elementor-widget-text-editor\" data-id=\"76d0fc7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The next step is to import the &#8216;errorHandler&#8217; method in our test file.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0ad96d8 elementor-widget elementor-widget-image\" data-id=\"0ad96d8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"640\" height=\"47\" src=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-1024x75.png\" class=\"attachment-large size-large wp-image-716\" alt=\"\" srcset=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-1024x75.png 1024w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-300x22.png 300w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-768x57.png 768w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-1536x113.png 1536w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-850x63.png 850w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-24x2.png 24w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-36x3.png 36w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31-48x4.png 48w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.16.31.png 1630w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-53d6b0b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"53d6b0b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b572f05\" data-id=\"b572f05\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-30a461f elementor-widget elementor-widget-text-editor\" data-id=\"30a461f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Note: depending on your test file location, you might have a different &#8220;from &#8216;<strong>.\/lib<\/strong>&#8216;&#8221; path. Also double check ErrorHandler ends with &#8216;<strong>.js<\/strong>&#8216;<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2fe45ec elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2fe45ec\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7df0505\" data-id=\"7df0505\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6df008e elementor-widget elementor-widget-text-editor\" data-id=\"6df008e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Last but not least, include the errorHandler.logError method in each of your tests.<br \/><br \/>Test example:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-bab9f55 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"bab9f55\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f3be8eb\" data-id=\"f3be8eb\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1a96c82 elementor-widget elementor-widget-image\" data-id=\"1a96c82\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"199\" src=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-1024x318.png\" class=\"attachment-large size-large wp-image-718\" alt=\"\" srcset=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-1024x318.png 1024w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-300x93.png 300w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-768x238.png 768w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-1536x477.png 1536w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-2048x636.png 2048w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-850x264.png 850w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-24x7.png 24w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-36x11.png 36w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.23.33-48x15.png 48w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-25327c7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"25327c7\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f1f540a\" data-id=\"f1f540a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8f8c162 elementor-widget elementor-widget-text-editor\" data-id=\"8f8c162\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>That&#8217;s it! Simple, isn&#8217;t it? Now whenever a test happens to fail, you will see in the console the actual error &#8211; e.g. below example shows an actual status code of 502 that causes test failure<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-740ae05 elementor-widget elementor-widget-image\" data-id=\"740ae05\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"200\" src=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-1024x320.png\" class=\"attachment-large size-large wp-image-719\" alt=\"\" srcset=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-1024x320.png 1024w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-300x94.png 300w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-768x240.png 768w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-1536x479.png 1536w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-2048x639.png 2048w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-850x265.png 850w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-24x7.png 24w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-36x11.png 36w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32-48x15.png 48w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5266a98 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5266a98\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-88becdf\" data-id=\"88becdf\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a916fb9 elementor-widget elementor-widget-text-editor\" data-id=\"a916fb9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>You can find more information regarding this approach and also the <strong>source code<\/strong> in the official Grafana documentation <a href=\"https:\/\/grafana.com\/docs\/k6\/latest\/examples\/error-handler\/\" target=\"_blank\" rel=\"noopener\">HERE<\/a><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f2bf772 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f2bf772\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-82b3637\" data-id=\"82b3637\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-01e0d4b elementor-widget elementor-widget-text-editor\" data-id=\"01e0d4b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Enjoyed this article? Make sure to subscribe to my\u00a0<em><a href=\"https:\/\/www.youtube.com\/@LearnwithRV\" target=\"_blank\" rel=\"noopener\">YouTube Channel<\/a><\/em>\u00a0for more Test Automation tutorials, and follow me on\u00a0<a href=\"https:\/\/www.linkedin.com\/in\/razvanvancea\/\" target=\"_blank\" rel=\"noopener\"><em>LinkedIn<\/em><\/a>\u00a0and\u00a0<em><a href=\"https:\/\/twitter.com\/razvanvancea\" target=\"_blank\" rel=\"noopener\">Twitter<\/a><\/em>\u00a0for regular insights.<strong><br \/>Looking to improve your test automation skills?<br \/><\/strong>I\u2019ve created a<strong>\u00a0personalized 1-on-1 Mentoring program\u00a0<\/strong>refined to<strong>\u00a0boost YOUR skills.\u00a0<\/strong>Reach out at\u00a0<a rel=\"noopener\">iamrv@razvanvancea.ro<\/a>\u00a0for more details and\u00a0<strong>together\u00a0<\/strong>will create a<strong>\u00a0learning path\u00a0<\/strong>adapted to your<strong>\u00a0current skills and goals\u00a0<\/strong>that you are aiming for<strong>,<\/strong>\u00a0in a<strong>\u00a0timely-efficient manner\ud83d\ude80<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Apparently, when you run k6 load tests and some of them fails, by default you&#8230;<\/p>\n","protected":false},"author":2,"featured_media":719,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[20,12],"tags":[],"class_list":["post-713","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-k6","category-tools"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Razvan Vancea\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Learn with RV - Tech Blog - #testautomation #qa #programming #linux #devops\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-08-12T07:26:07+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-05-24T05:15:50+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/razvanvancea\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@RazvanVancea\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@RazvanVancea\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#blogposting\",\"name\":\"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog\",\"headline\":\"How to add Error Handler to log errors in k6 load tests\",\"author\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/08\\\/Screenshot-2024-08-12-at-10.29.32.png\",\"width\":2992,\"height\":934},\"datePublished\":\"2024-08-12T07:26:07+00:00\",\"dateModified\":\"2026-05-24T05:15:50+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#webpage\"},\"articleSection\":\"k6, Tools\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/#listItem\",\"name\":\"Tools\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/#listItem\",\"position\":2,\"name\":\"Tools\",\"item\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/k6\\\/#listItem\",\"name\":\"k6\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/k6\\\/#listItem\",\"position\":3,\"name\":\"k6\",\"item\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/k6\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#listItem\",\"name\":\"How to add Error Handler to log errors in k6 load tests\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/#listItem\",\"name\":\"Tools\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#listItem\",\"position\":4,\"name\":\"How to add Error Handler to log errors in k6 load tests\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/tools\\\/k6\\\/#listItem\",\"name\":\"k6\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#person\",\"name\":\"RV\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#personImage\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/91ce41471f9ba5f15b3ef99e7deed87c.jpg?ver=1785997097\",\"width\":96,\"height\":96,\"caption\":\"RV\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/razvanvancea\\\/\",\"https:\\\/\\\/twitter.com\\\/RazvanVancea\",\"https:\\\/\\\/www.youtube.com\\\/@LearnwithRV\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/razvanvancea\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/\",\"name\":\"Razvan Vancea\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#authorImage\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/356548feb901191539c03dd4a0498f58.jpg?ver=1785997099\",\"width\":96,\"height\":96,\"caption\":\"Razvan Vancea\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#webpage\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/\",\"name\":\"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog\",\"description\":\"Apparently, when you run k6 load tests and some of them fails, by default you don\\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/08\\\/Screenshot-2024-08-12-at-10.29.32.png\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#mainImage\",\"width\":2992,\"height\":934},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2024\\\/08\\\/12\\\/how-to-add-error-handler-to-log-errors-in-k6\\\/#mainImage\"},\"datePublished\":\"2024-08-12T07:26:07+00:00\",\"dateModified\":\"2026-05-24T05:15:50+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/\",\"name\":\"Learn with RV - Tech Blog\",\"description\":\"#testautomation #qa #programming #linux #devops\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog","description":"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need","canonical_url":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#blogposting","name":"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog","headline":"How to add Error Handler to log errors in k6 load tests","author":{"@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author"},"publisher":{"@id":"https:\/\/razvanvancea.ro\/blog\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32.png","width":2992,"height":934},"datePublished":"2024-08-12T07:26:07+00:00","dateModified":"2026-05-24T05:15:50+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#webpage"},"isPartOf":{"@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#webpage"},"articleSection":"k6, Tools"},{"@type":"BreadcrumbList","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/razvanvancea.ro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/#listItem","name":"Tools"}},{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/#listItem","position":2,"name":"Tools","item":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/","nextItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/k6\/#listItem","name":"k6"},"previousItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/k6\/#listItem","position":3,"name":"k6","item":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/k6\/","nextItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#listItem","name":"How to add Error Handler to log errors in k6 load tests"},"previousItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/#listItem","name":"Tools"}},{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#listItem","position":4,"name":"How to add Error Handler to log errors in k6 load tests","previousItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/k6\/#listItem","name":"k6"}}]},{"@type":"Person","@id":"https:\/\/razvanvancea.ro\/blog\/#person","name":"RV","image":{"@type":"ImageObject","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#personImage","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/litespeed\/avatar\/91ce41471f9ba5f15b3ef99e7deed87c.jpg?ver=1785997097","width":96,"height":96,"caption":"RV"},"sameAs":["https:\/\/www.facebook.com\/razvanvancea\/","https:\/\/twitter.com\/RazvanVancea","https:\/\/www.youtube.com\/@LearnwithRV","https:\/\/www.linkedin.com\/in\/razvanvancea"]},{"@type":"Person","@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author","url":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/","name":"Razvan Vancea","image":{"@type":"ImageObject","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#authorImage","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/litespeed\/avatar\/356548feb901191539c03dd4a0498f58.jpg?ver=1785997099","width":96,"height":96,"caption":"Razvan Vancea"}},{"@type":"WebPage","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#webpage","url":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/","name":"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog","description":"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/razvanvancea.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#breadcrumblist"},"author":{"@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author"},"creator":{"@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32.png","@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#mainImage","width":2992,"height":934},"primaryImageOfPage":{"@id":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/#mainImage"},"datePublished":"2024-08-12T07:26:07+00:00","dateModified":"2026-05-24T05:15:50+00:00"},{"@type":"WebSite","@id":"https:\/\/razvanvancea.ro\/blog\/#website","url":"https:\/\/razvanvancea.ro\/blog\/","name":"Learn with RV - Tech Blog","description":"#testautomation #qa #programming #linux #devops","inLanguage":"en-US","publisher":{"@id":"https:\/\/razvanvancea.ro\/blog\/#person"}}]},"og:locale":"en_US","og:site_name":"Learn with RV - Tech Blog - #testautomation #qa #programming #linux #devops","og:type":"article","og:title":"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog","og:description":"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need","og:url":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/","article:published_time":"2024-08-12T07:26:07+00:00","article:modified_time":"2026-05-24T05:15:50+00:00","article:publisher":"https:\/\/www.facebook.com\/razvanvancea","twitter:card":"summary_large_image","twitter:site":"@RazvanVancea","twitter:title":"How to add Error Handler to log errors in k6 load tests - Learn with RV - Tech Blog","twitter:description":"Apparently, when you run k6 load tests and some of them fails, by default you don\u2019t have access to the errors in the console (the only things displayed are the test name and the expected result, but NOT the actual result). In order to see the actual results that caused the failure, you will need","twitter:creator":"@RazvanVancea"},"aioseo_meta_data":{"post_id":"713","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2024-08-12 07:45:19","updated":"2026-05-30 10:54:34","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/razvanvancea.ro\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/razvanvancea.ro\/blog\/category\/tools\/\" title=\"Tools\">Tools<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/razvanvancea.ro\/blog\/category\/tools\/k6\/\" title=\"k6\">k6<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to add Error Handler to log errors in k6 load tests\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/razvanvancea.ro\/blog"},{"label":"Tools","link":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/"},{"label":"k6","link":"https:\/\/razvanvancea.ro\/blog\/category\/tools\/k6\/"},{"label":"How to add Error Handler to log errors in k6 load tests","link":"https:\/\/razvanvancea.ro\/blog\/2024\/08\/12\/how-to-add-error-handler-to-log-errors-in-k6\/"}],"jetpack_featured_media_url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-12-at-10.29.32.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts\/713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/comments?post=713"}],"version-history":[{"count":15,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts\/713\/revisions"}],"predecessor-version":[{"id":943,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts\/713\/revisions\/943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/media\/719"}],"wp:attachment":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/media?parent=713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/categories?post=713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/tags?post=713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}