From 0858f525db29745c378a586cf777a6c356201372 Mon Sep 17 00:00:00 2001 From: Campbell Alden Date: Sun, 22 Mar 2026 00:29:15 +0900 Subject: [PATCH] Add more specific information when logging and report it over the API --- reporter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reporter.js b/reporter.js index bdae535..96bddc3 100644 --- a/reporter.js +++ b/reporter.js @@ -14,15 +14,15 @@ import fs from 'fs'; function parse(data) { if (typeof data !== 'object' || data === null) { - throw new Error('Bad Data'); + throw new Error(`Bad Data, expected an object, got: ${data === null ? null : typeof data}`); } if (typeof data.title !== 'string') { - throw new Error('Bad Title'); + throw new Error(`Bad Title: ${data.title}`); } if (typeof data.amount !== 'number' || typeof data.amount !== 'string') { - throw new Error('Bad amount'); + throw new Error(`Bad amount: ${data.amount}`); } if (typeof data.amount === 'string') { @@ -85,7 +85,7 @@ async function init() { console.log('Transaction failed...'); console.log(e); console.log(e.message); - return res.json({ result: 'failure' }); + return res.json({ result: 'failure', error: e.message }); } }); });