Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1900)

Unified Diff: bootstrap/win/get_file.js

Issue 72783002: Print the exact path get_file.js is trying to write to when failing. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bootstrap/win/get_file.js
diff --git a/bootstrap/win/get_file.js b/bootstrap/win/get_file.js
index ef0860135f17f0153e4f8eb86c43ff895a95c6c9..2561fb3c3d7972d920a964fee8ea29d65cbfa2f1 100644
--- a/bootstrap/win/get_file.js
+++ b/bootstrap/win/get_file.js
@@ -9,14 +9,14 @@ function Download(url, path, verbose) {
try {
xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP");
} catch (e) {
- WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
+ WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
": Cannot create Active-X object (" + e.description) + ").";
WScript.Quit(1);
}
try {
xml_http.open("GET", url, false);
} catch (e) {
- WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
+ WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
": invalid URL.");
WScript.Quit(1);
}
@@ -27,7 +27,7 @@ function Download(url, path, verbose) {
try {
xml_http.send(null);
if (xml_http.status != 200) {
- WScript.StdOut.WriteLine("[-] HTTP " + xml_http.status + " " +
+ WScript.StdOut.WriteLine("[-] HTTP " + xml_http.status + " " +
xml_http.statusText);
WScript.Quit(1);
}
@@ -45,7 +45,7 @@ function Download(url, path, verbose) {
}
}
} catch (e) {
- WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
+ WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +
": Cannot make HTTP request (" + e.description) + ")";
WScript.Quit(1);
}
@@ -64,8 +64,9 @@ function Download(url, path, verbose) {
adodb_stream.SaveToFile(path, 2); // Save to our destination
adodb_stream.Close();
} catch(e) {
- WScript.StdOut.WriteLine("[-] ADODB.Stream " + new Number(
- e.number).toHex() + ": Cannot save file (" + e.description + ")");
+ WScript.StdOut.WriteLine(
+ "[-] ADODB.Stream " + new Number(e.number).toHex() +
+ ": Cannot save file to " + path + ": " + e.description);
WScript.Quit(1);
}
if (typeof(file_size) != undefined) {
@@ -83,13 +84,13 @@ function Download(url, path, verbose) {
// Utilities
Number.prototype.isInt = function NumberIsInt() {
- return this % 1 == 0;
+ return this % 1 == 0;
};
Number.prototype.toBytes = function NumberToBytes() {
// Returns a "pretty" string representation of a number of bytes:
var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
var unit = "bytes";
- var limit = 1;
+ var limit = 1;
while(this > limit * 1100 && units.length > 0) {
limit *= 1024;
unit = units.shift();
@@ -99,11 +100,11 @@ Number.prototype.toBytes = function NumberToBytes() {
Number.prototype.toHex = function NumberToHex(length) {
if (arguments.length == 0) length = 1;
if (typeof(length) != "number" && !(length instanceof Number)) {
- throw Exception("Length must be a positive integer larger than 0.",
+ throw Exception("Length must be a positive integer larger than 0.",
TypeError, 0);
}
if (length < 1 || !length.isInt()) {
- throw Exception("Length must be a positive integer larger than 0.",
+ throw Exception("Length must be a positive integer larger than 0.",
"RangeError", 0);
}
var result = (this + (this < 0 ? 0x100000000 : 0)).toString(16);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698