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

Unified Diff: chrome/browser/resources/cryptotoken/webrequest.js

Issue 607913003: Improved error reporting in cryptotoken (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 | « chrome/browser/resources/cryptotoken/signer.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/cryptotoken/webrequest.js
diff --git a/chrome/browser/resources/cryptotoken/webrequest.js b/chrome/browser/resources/cryptotoken/webrequest.js
index c9b361788a429e1ba10b17eaebae0da0acc63a27..7a1996b74a10e33106fd4616c572c99d049291c9 100644
--- a/chrome/browser/resources/cryptotoken/webrequest.js
+++ b/chrome/browser/resources/cryptotoken/webrequest.js
@@ -228,24 +228,27 @@ function mapErrorCodeToGnubbyCodeType(errorCode, forSign) {
}
/**
- * Maps a helper's error code from the DeviceStatusCodes namespace to the
- * ErrorCodes namespace.
+ * Maps a helper's error code from the DeviceStatusCodes namespace to a
+ * U2fError.
* @param {number} code Error code from DeviceStatusCodes namespace.
- * @return {ErrorCodes} A ErrorCodes error code.
+ * @return {U2fError} An error.
*/
-function mapDeviceStatusCodeToErrorCode(code) {
- var reportedError = ErrorCodes.OTHER_ERROR;
+function mapDeviceStatusCodeToU2fError(code) {
switch (code) {
case DeviceStatusCodes.WRONG_DATA_STATUS:
- reportedError = ErrorCodes.DEVICE_INELIGIBLE;
- break;
+ return {errorCode: ErrorCodes.DEVICE_INELIGIBLE};
case DeviceStatusCodes.TIMEOUT_STATUS:
case DeviceStatusCodes.WAIT_TOUCH_STATUS:
- reportedError = ErrorCodes.TIMEOUT;
- break;
+ return {errorCode: ErrorCodes.TIMEOUT};
+
+ default:
+ var reportedError = {
+ errorCode: ErrorCodes.OTHER_ERROR,
+ errorMessage: 'device status code: ' + code.toString(16)
+ };
+ return reportedError;
}
- return reportedError;
}
/**
« no previous file with comments | « chrome/browser/resources/cryptotoken/signer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698