MCPcopy Create free account
hub / github.com/BridgeAR/safe-stable-stringify / safeMethod

Function safeMethod

index.js:255–264  ·  view source on GitHub ↗
(...input)

Source from the content-addressed store, hash-verified

253
254function makeSafe (method, name) {
255 const safeMethod = function (...input) {
256 try {
257 return method(...input)
258 } catch (error) {
259 if (name !== undefined) {
260 return getErrorMessage(error, name)
261 }
262 return strEscape(getErrorMessage(error, name))
263 }
264 }
265 Object.defineProperty(safeMethod, 'name', { value: `safe_${method.name}` })
266 return safeMethod
267}

Callers

nothing calls this directly

Calls 2

getErrorMessageFunction · 0.85
strEscapeFunction · 0.85

Tested by

no test coverage detected