@danielkalen/simplybind
Version:
Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.
22 lines (16 loc) • 470 B
text/coffeescript
throwError = (errorName)->
throw new Error 'SimplyBind: '+(errors[errorName] or errorName)
throwWarning = (warningName, depth)-> unless settings.silent
errSource = getErrSource(depth)
warn = errors[warningName]
warn += "\n\n"+errSource
console.warn('SimplyBind: '+warn)
return
throwErrorBadArg = (arg)->
throwError "Invalid argument/s (#{arg})", true
return
getErrSource = (depth)->
((new Error).stack or '')
.split('\n')
.slice(depth+3)
.join('\n')