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

Unified Diff: runtime/bin/secure_socket.h

Issue 16305005: dart:io | Improve NSS and SSL error messages for secure networking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.h
diff --git a/runtime/bin/secure_socket.h b/runtime/bin/secure_socket.h
index 0eecd3c8b3e04c57db1b9e39f16c139e2ed5e404..45334d6ab6bea127e662a1cecb91d2d97c9fd621 100644
--- a/runtime/bin/secure_socket.h
+++ b/runtime/bin/secure_socket.h
@@ -35,17 +35,11 @@ static void ThrowException(const char* message) {
/* Handle an error reported from the NSS library. */
static void ThrowPRException(const char* message) {
PRErrorCode error_code = PR_GetError();
- int error_length = PR_GetErrorTextLength();
- char* error_message = static_cast<char*>(malloc(error_length + 1));
- ASSERT(error_message != NULL);
- int copied_length = PR_GetErrorText(error_message);
- ASSERT(copied_length == error_length);
- error_message[error_length] = '\0';
+ const char* error_message = PR_ErrorToString(error_code, PR_LANGUAGE_EN);
OSError os_error_struct(error_code, error_message, OSError::kNSS);
Dart_Handle os_error = DartUtils::NewDartOSError(&os_error_struct);
Dart_Handle socket_io_exception =
DartUtils::NewDartSocketIOException(message, os_error);
- free(error_message);
Dart_ThrowException(socket_io_exception);
}
« 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