HTTPArchive / custom-metrics

Custom metrics to use with WebPageTest agents
Apache License 2.0
19 stars 22 forks source link

add error handling to avoid whole file breaks #78

Closed kara closed 1 year ago

kara commented 1 year ago

In a recent PR, all Aurora metrics were unavailable on some pages because an individual metric threw an error. This PR adds basic error handling so each metric is isolated and can't break the whole file.

Nuxt test run: https://www.webpagetest.org/result/230419_AiDcWV_CCS/2/details/ Angular test run: https://www.webpagetest.org/result/230419_BiDcXX_BXE/2/details/ React test run: https://www.webpagetest.org/result/230419_BiDcH4_2K3/1/details/

Test run with typo in two functions (typo manually added in WPT): https://www.webpagetest.org/result/230419_AiDcSC_CCW/1/details/

tunetheweb commented 1 year ago

LGTM. You could make it slightly cleaner by moving the || null into the function call.

kara commented 1 year ago

LGTM. You could make it slightly cleaner by moving the || null into the function call.

Ah, great point. Updated! (updated the test run links as well)

kara commented 1 year ago

Thanks for the review! Should be good to merge now.