UNPKG

@powership/server

Version:
1 lines 1.32 kB
{"version":3,"file":"serverErrors.mjs","names":["createErrorClass","NotImplementedError","throwNotImplemented","values","errors","Object","entries","forEach","name","v","undefined","push","length","error","join"],"sources":["../src/serverErrors.ts"],"sourcesContent":["import { createErrorClass } from '@powership/utils';\n\nexport const NotImplementedError = createErrorClass('NotImplemented');\n\nexport function throwNotImplemented(values: Record<string, any>) {\n const errors: string[] = [];\n Object.entries(values).forEach(([name, v]) => {\n if (v !== undefined && v !== null) {\n errors.push(`${name} not implemented yet.`);\n }\n });\n\n if (errors.length) {\n const error = new NotImplementedError(errors.join('\\n'));\n\n throw error;\n }\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,kBAAkB;AAEnD,OAAO,MAAMC,mBAAmB,GAAGD,gBAAgB,CAAC,gBAAgB,CAAC;AAErE,OAAO,SAASE,mBAAmBA,CAACC,MAA2B,EAAE;EAC/D,MAAMC,MAAgB,GAAG,EAAE;EAC3BC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,CAAC,CAAC,KAAK;IAC5C,IAAIA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI,EAAE;MACjCL,MAAM,CAACO,IAAI,CAAC,GAAGH,IAAI,uBAAuB,CAAC;IAC7C;EACF,CAAC,CAAC;EAEF,IAAIJ,MAAM,CAACQ,MAAM,EAAE;IACjB,MAAMC,KAAK,GAAG,IAAIZ,mBAAmB,CAACG,MAAM,CAACU,IAAI,CAAC,IAAI,CAAC,CAAC;IAExD,MAAMD,KAAK;EACb;AACF","ignoreList":[]}