import * as os from 'os' ; import { parseError } from 'vscode-azureextensionui' ; param outerMessage param innerError export function wrapError ( outerMessage , innerError ) { const newMessage = outerMessage + " " + os . EOL + parseError ( innerError ) . message ; if ( innerError instanceof Error ) { const copy = cloneError ( innerError ) ; copy . message = newMessage ; return copy ; } else { return new Error ( newMessage ) ; } } function cloneError ( error ) { const copy = new Error ( ) ; for ( const propName of Object . getOwnPropertyNames ( error ) ) { try { ( < any > copy ) [ propName ] = ( < any > error ) [ propName ] ; } catch ( err2 ) { } } return copy ; }