@connectedyard/node-jlink
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -10,3 +10,44 @@ ( function(){ | ||
function JLinkError( message ){ | ||
this.constructor.prototype.__proto__ = Error.prototype; // Make this an instanceof Error. | ||
Error.call(this); // Does not seem necessary. Perhaps remove this line? | ||
Error.captureStackTrace(this, this.constructor); // Creates the this.stack getter | ||
this.name = this.constructor.name; // Used to cause messages like "UserError: message" instead of the default "Error: message" | ||
this.message = message; // Used to set the message | ||
} | ||
/* | ||
ERROR: { | ||
stdout: 'SEGGER J-Link Commander V5.10n (Compiled Feb 19 2016 18:41:48)\n | ||
DLL version V5.10n, compiled Feb 19 2016 18:41:43\n\n | ||
Connecting to J-Link via USB...O.K.\n | ||
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Feb 12 2016 12:15:53\n | ||
Hardware version: V1.00\nS/N: 681501598\nEmulator has Trace capability\n\ | ||
VTref = 3.300V\n\n\n | ||
Type "connect" to establish a target connection, \'?\' for help\n | ||
J-Link Commander will now exit on Error\n | ||
Target connection not established yet but required for command.\n | ||
Device "NRF51822_XXAA" selected.\n\n\nCan not connect to target.\n | ||
Could not read memory.\n', | ||
stderr: '', | ||
code: 1, | ||
error: null } | ||
*/ | ||
JLinkError.withExecResult = function( execResult ){ | ||
if( !execResult ) return new JLinkError( "JLink command failed" ); | ||
var text = execResult.stdout; | ||
if( text && text.length > 0 ){ | ||
if( text.indexOf("J-Link Commander will now exit on Error") !== -1 ){ | ||
text = text.split("J-Link Commander will now exit on Error")[1]; // everything after this error sentinel | ||
} | ||
}else{ | ||
text = text.stderr; | ||
} | ||
text = text.split('\n').join(' '); // single line what's left | ||
var error = new JLinkError( text ); | ||
return error; | ||
}; | ||
exports.defaultJLinkEXEForPlatform = function(){ | ||
@@ -73,3 +114,3 @@ if( process.env[ 'JLINKEXE' ] ){ | ||
if( code === 0 ) resolve( result ); | ||
else reject( result ); | ||
else reject( JLinkError.withExecResult( result)); | ||
}); | ||
@@ -76,0 +117,0 @@ |
{ | ||
"name": "@connectedyard/node-jlink", | ||
"version": "1.0.10", | ||
"version": "1.1.0", | ||
"description": "jLinkexe driver for nodejs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,4 +33,5 @@ ( function(){ | ||
.catch( function( error ){ | ||
console.log("Test Fail: ", error ); | ||
console.log("Test Failed"); | ||
throw error; | ||
}); | ||
})(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59912
330