Skip to content

Commit bdc95ba

Browse files
committed
Implement Herbie warning display
1 parent ba4facd commit bdc95ba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/herbie/lib/herbiejs.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getVarnamesFPCore } from './fpcore';
22
import * as ordinals from './ordinals';
33
import { ErrorExpressionResponse, Sample, LocalErrorTree } from '../HerbieTypes';
44
import { getApi } from './servercalls';
5+
import { showErrorToast } from '../../ErrorToast';
56

67
interface HerbieResponse {
78
error?: string;
@@ -84,7 +85,16 @@ const getHerbieApi = async (
8485
if (responseData.error) {
8586
throw new Error('Herbie server: ' + responseData.error);
8687
}
87-
console.debug('got data', responseData);
88+
const warnings = responseData.warnings
89+
console.log(warnings)
90+
if (warnings) {
91+
for (const [type, message, link, details] of warnings) {
92+
showErrorToast(
93+
`Warning: ${type}\nMessage: ${message}\nDetails: ${details.join(", ")}\nMore info: ${link}`
94+
);
95+
}
96+
}
97+
console.log('got data', responseData);
8898
return responseData;
8999
} catch (error: any) {
90100
throw new Error(`Error sending data to Herbie server at ${url}:\n${error.message}`)

0 commit comments

Comments
 (0)