MCPcopy Index your code
hub / github.com/rohitg00/agentmemory / extractErrorMessage

Function extractErrorMessage

plugin/opencode/agentmemory-capture.ts:155–168  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

153}
154
155function extractErrorMessage(err: unknown): string {
156 if (typeof err === "string") return err;
157 if (err && typeof err === "object") {
158 const e = err as Record<string, unknown>;
159 if (typeof e.message === "string") return e.message;
160 if (e.data && typeof e.data === "object") {
161 const d = e.data as Record<string, unknown>;
162 if (typeof d.message === "string") return d.message;
163 }
164 if (typeof e.name === "string") return e.name;
165 try { return JSON.stringify(err); } catch { return ""; }
166 }
167 return String(err ?? "");
168}
169
170export const AgentmemoryCapturePlugin: Plugin = async (ctx) => {
171 projectPath = ctx.worktree || ctx.project?.id || process.cwd();

Callers 1

AgentmemoryCapturePluginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected