| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/webdriver/webdriver_error.h" | 5 #include "chrome/test/webdriver/webdriver_error.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 namespace webdriver { | 9 namespace webdriver { |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 std::string Error::ToString() const { | 66 std::string Error::ToString() const { |
| 67 std::string error; | 67 std::string error; |
| 68 if (code_ != kUnknownError) { | 68 if (code_ != kUnknownError) { |
| 69 error += ErrorCodeToString(code_); | 69 error += ErrorCodeToString(code_); |
| 70 error += ": "; | 70 error += ": "; |
| 71 } | 71 } |
| 72 if (details_.length()) { | 72 if (details_.length()) { |
| 73 error += details_; | 73 error += details_; |
| 74 } | 74 } |
| 75 |
| 76 // Only include a stacktrace on Linux. Windows and Mac have all symbols |
| 77 // stripped in release builds. |
| 78 #if defined(OS_LINUX) |
| 75 size_t count = 0; | 79 size_t count = 0; |
| 76 trace_.Addresses(&count); | 80 trace_.Addresses(&count); |
| 77 if (count > 0) { | 81 if (count > 0) { |
| 78 std::ostringstream ostream; | 82 std::ostringstream ostream; |
| 79 trace_.OutputToStream(&ostream); | 83 trace_.OutputToStream(&ostream); |
| 80 error += "\n"; | 84 error += "\n"; |
| 81 error += ostream.str(); | 85 error += ostream.str(); |
| 82 } | 86 } |
| 87 #endif |
| 83 return error; | 88 return error; |
| 84 } | 89 } |
| 85 | 90 |
| 86 ErrorCode Error::code() const { | 91 ErrorCode Error::code() const { |
| 87 return code_; | 92 return code_; |
| 88 } | 93 } |
| 89 | 94 |
| 90 const std::string& Error::details() const { | 95 const std::string& Error::details() const { |
| 91 return details_; | 96 return details_; |
| 92 } | 97 } |
| 93 | 98 |
| 94 const base::debug::StackTrace& Error::trace() const { | 99 const base::debug::StackTrace& Error::trace() const { |
| 95 return trace_; | 100 return trace_; |
| 96 } | 101 } |
| 97 | 102 |
| 98 } // namespace webdriver | 103 } // namespace webdriver |
| OLD | NEW |