MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / copyError

Function copyError

src/back/util/misc.ts:52–65  ·  view source on GitHub ↗
(error: any)

Source from the content-addressed store, hash-verified

50 * @param error Error to copy
51 */
52export function copyError(error: any): ErrorCopy {
53 if (typeof error !== 'object' || error === null) { error = {}; }
54 const copy: ErrorCopy = {
55 message: error.message+'',
56 name: error.name+'',
57 };
58 // @TODO These properties are not standard, and perhaps they have different types in different environments.
59 // So do some testing and add some extra checks mby?
60 if (typeof error.columnNumber === 'number') { copy.columnNumber = error.columnNumber; }
61 if (typeof error.fileName === 'string') { copy.fileName = error.fileName; }
62 if (typeof error.lineNumber === 'number') { copy.lineNumber = error.lineNumber; }
63 if (typeof error.stack === 'string') { copy.stack = error.stack; }
64 return copy;
65}
66
67export function procToService(proc: ManagedChildProcess): IService {
68 return {

Callers 2

importAllMetaEditsFunction · 0.90
registerRequestCallbacksFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected