MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / errorMessage

Function errorMessage

src/utils/helpers.js:151–170  ·  view source on GitHub ↗

* Gets error message from error object * @param {Error} err * @param {...string} args

(err, ...args)

Source from the content-addressed store, hash-verified

149 * @param {...string} args
150 */
151 errorMessage(err, ...args) {
152 args.forEach((arg, i) => {
153 if (/^(content|file|ftp|sftp|https?):/.test(arg)) {
154 args[i] = this.getVirtualPath(arg);
155 }
156 });
157
158 const extra = args.join("<br>");
159 let msg;
160
161 if (typeof err === "string" && err) {
162 msg = err;
163 } else if (err instanceof Error) {
164 msg = err.message;
165 } else {
166 msg = strings["an error occurred"];
167 }
168
169 return msg + (extra ? "<br>" + extra : "");
170 },
171 /**
172 *
173 * @param {Error} err

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected