diff --git a/scripts/external/processor.js b/scripts/external/processor.js index 526748b..4d86b06 100644 --- a/scripts/external/processor.js +++ b/scripts/external/processor.js @@ -15,13 +15,23 @@ export default class processor { } async analyze() { - this.product = new product(this.data); + // Do not reset the product data, just re-use it. + this.product = (!this.product) ? new product(this.data) : this.product; await this.product.attach(); + + // Set up current data of the site, but forget about its previous errored state. + this.product.status[`done`] = false; + delete this.product.status[`error`]; + + // First save the SHA512 summary of the scraped data. + this.product.save(); + + // Try analysis of the data. try { await this.product.analyze(); } catch(err) { logging.error(err.name, err.message, err.stack, false); - this.product.status[`error`] = true; + this.product.status[`error`] = err; }; // Indicate that the process is done.