show detail error to api test

This commit is contained in:
Gabe Yuan
2023-11-02 23:35:36 +08:00
parent 84de1e0f12
commit 94288b5dc3
3 changed files with 23 additions and 4 deletions

View File

@@ -46,7 +46,20 @@ function TestButton({ translator, api }) {
}
alert.success(i18n("test_success"));
} catch (err) {
alert.error(`${i18n("test_failed")}: ${err.message}`);
// alert.error(`${i18n("test_failed")}: ${err.message}`);
alert.error(
<>
<div>{`${i18n("test_failed")}: ${err.message}`}</div>
<pre
style={{
maxWidth: 400,
overflow: "auto",
}}
>
{JSON.stringify(err.cause || {}, null, 2)}
</pre>
</>
);
} finally {
setLoading(false);
}