Skip to content

Know when extension fails

Nakul requested to merge nakulh/CarbonFootprint:fail into master

The idea is to make sure that when data is scraped from a website, it is not null or undefined and is valid data (for example an airport will always be a 3 character string). We can add different counter measures for different type of failures, like showing notification to user, automatically disabling extension for a website, throwing error, get notification about failure of a website through google analytics.

I've implemented this by writing wrapper functions for getElementById, getElementsByClassName and when childNodes are accessed. Also functions for verification of data have been added for flights, like checking if airplane string is not too long, airport string is of 3 characters.

I've developed this keeping flight ticket websites in mind, will soon add functions for rail ticket websites and maps.

Need feedback on the idea and its implementation.

Edited by Nakul

Merge request reports