@ethisyscore/plugin-ui 1.100.4 → 1.100.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,14 +65,20 @@ function splitStatusPrefix(message) {
65
65
  }
66
66
  return body.length > 0 ? { status, body } : { status: null, body: message };
67
67
  }
68
+ var ErrorCodePrefix = new RegExp(String.raw`^\[[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+\]\s*`);
69
+ function stripErrorCodePrefix(body) {
70
+ const stripped = body.replace(ErrorCodePrefix, "");
71
+ return stripped.length > 0 ? stripped : body;
72
+ }
68
73
  function surfaceError(error, meta) {
69
74
  if (meta?.suppressErrorToast === true) {
70
75
  return;
71
76
  }
72
77
  const raw = error instanceof Error && error.message.length > 0 ? error.message : "An unexpected error occurred";
73
78
  const { status, body } = splitStatusPrefix(raw);
79
+ const reason = stripErrorCodePrefix(body);
74
80
  const title = meta?.errorTitle ?? (status !== null ? STATUS_TITLES.get(status) ?? GENERIC_TITLE : GENERIC_TITLE);
75
- showErrorToast(title, body);
81
+ showErrorToast(title, reason);
76
82
  }
77
83
  function createPluginQueryClient(config) {
78
84
  return new reactQuery.QueryClient({