feat: better error messaging

This commit is contained in:
Anoop M D 2023-01-29 18:04:17 +05:30
parent c328281f21
commit 2e32423869
5 changed files with 7 additions and 10 deletions

View File

@ -47,7 +47,6 @@
"react-hot-toast": "^2.4.0",
"react-redux": "^7.2.6",
"react-tooltip": "^5.5.2",
"reckonjs": "^0.1.2",
"sass": "^1.46.0",
"split-on-first": "^3.0.0",
"styled-components": "^5.3.3",

View File

@ -19,8 +19,8 @@ const TestResults = ({ results }) => {
Tests ({results.length}/{results.length}), Passed: {passedTests.length}, Failed: {failedTests.length}
</div>
<ul className="">
{results.map((result, index) => (
<li key={index} className="py-1">
{results.map((result) => (
<li key={result.uid} className="py-1">
{result.status === 'pass' ? (
<span className="test-success">
&#x2714;&nbsp; {result.description}

View File

@ -1,5 +1,5 @@
import path from 'path';
import filter from 'lodash/filter';
import toast from 'react-hot-toast';
import trim from 'lodash/trim';
import { uuid } from 'utils/common';
import cloneDeep from 'lodash/cloneDeep';
@ -17,7 +17,6 @@ import {
isItemARequest,
isItemAFolder,
refreshUidsInItem,
interpolateEnvironmentVars
} from 'utils/collections';
import { collectionSchema, itemSchema, environmentSchema, environmentsSchema } from '@usebruno/schema';
import { waitForNextTick } from 'utils/common';
@ -131,7 +130,7 @@ export const sendRequest = (item, collectionUid) => (dispatch, getState) => {
);
console.log('>> sending request failed');
console.log(err);
reject(err);
toast.error(err ? err.message : 'Something went wrong!');
});
});
};

View File

@ -11,10 +11,6 @@ import cloneDeep from 'lodash/cloneDeep';
import { uuid } from 'utils/common';
import path from 'path';
// although we are not using rekonjs directly
// its populating the global string prototype with .reckon method
import reckon from 'reckonjs';
const replaceTabsWithSpaces = (str, numSpaces = 2) => {
if (!str || !str.length || !isString(str)) {
return '';

View File

@ -1,9 +1,12 @@
const {nanoid} = require('nanoid');
class TestResults {
constructor() {
this.results = [];
}
addResult(result) {
result.uid = nanoid();
this.results.push(result);
}