|
42 | 42 | // $('#tests').append(`<p style="color:green;">${msg}</p>`); |
43 | 43 | } |
44 | 44 |
|
45 | | - window.fail = function(msg) { |
46 | | - throw new Error(msg); |
| 45 | + window.fail = function(msg, error) { |
| 46 | + // Include the full error information in the thrown error |
| 47 | + let fullMessage = msg; |
| 48 | + if (error) { |
| 49 | + if (typeof error === 'string') { |
| 50 | + fullMessage += ' ' + error; |
| 51 | + } else if (error.message) { |
| 52 | + fullMessage += ' ' + error.message; |
| 53 | + } else { |
| 54 | + fullMessage += ' ' + JSON.stringify(error); |
| 55 | + } |
| 56 | + } |
| 57 | + const err = new Error(fullMessage); |
| 58 | + // Attach the original error for detailed display |
| 59 | + err.originalError = error; |
| 60 | + throw err; |
47 | 61 | } |
48 | 62 |
|
49 | 63 | // print the test name with checkbox for each test |
|
79 | 93 | $(`#fsTests-container-${i}`).css('background-color', '#85e085'); |
80 | 94 |
|
81 | 95 | } catch (e) { |
82 | | - console.log(e); |
| 96 | + console.error('FS Test failed:', fsTests[i].name, e); |
83 | 97 | // make this test's container red |
84 | 98 | $(`#fsTests-container-${i}`).css('background-color', '#ffbfbf'); |
85 | | - // message |
86 | | - $(`#fsTests-container-${i}`).append(`<p style="color:#c00000;">${e}</p>`); |
| 99 | + // message - show full error information including JSON details |
| 100 | + let errorMessage = e.message || e.toString(); |
| 101 | + if (e.originalError) { |
| 102 | + errorMessage += '\n\nOriginal Error:\n' + JSON.stringify(e.originalError, null, 2); |
| 103 | + } |
| 104 | + $(`#fsTests-container-${i}`).append(`<pre style="color:#c00000; white-space: pre-wrap; font-size: 12px; margin: 5px 0; padding: 10px; background-color: #f8f8f8; border-radius: 3px;">${errorMessage}</pre>`); |
87 | 105 | } |
88 | 106 | } |
89 | 107 | } |
|
96 | 114 | $(`#kvTests-container-${i}`).css('background-color', '#85e085'); |
97 | 115 |
|
98 | 116 | } catch (e) { |
| 117 | + console.error('KV Test failed:', kvTests[i].name, e); |
99 | 118 | // make this test's container red |
100 | 119 | $(`#kvTests-container-${i}`).css('background-color', '#ff8484'); |
101 | | - // message |
102 | | - $(`#kvTests-container-${i}`).append(`<p style="color:red;">${e}</p>`); |
| 120 | + // message - show full error information including JSON details |
| 121 | + let errorMessage = e.message || e.toString(); |
| 122 | + if (e.originalError) { |
| 123 | + errorMessage += '\n\nOriginal Error:\n' + JSON.stringify(e.originalError, null, 2); |
| 124 | + } |
| 125 | + $(`#kvTests-container-${i}`).append(`<pre style="color:red; white-space: pre-wrap; font-size: 12px; margin: 5px 0; padding: 10px; background-color: #f8f8f8; border-radius: 3px;">${errorMessage}</pre>`); |
103 | 126 | } |
104 | 127 | } |
105 | 128 | } |
|
0 commit comments