(error: any)
| 50 | * @param error Error to copy |
| 51 | */ |
| 52 | export 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 | |
| 67 | export function procToService(proc: ManagedChildProcess): IService { |
| 68 | return { |
no outgoing calls
no test coverage detected