OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ErrorSupport.h" | 5 //#include "ErrorSupport.h" |
6 | 6 |
7 {% for namespace in config.protocol.namespace %} | 7 {% for namespace in config.protocol.namespace %} |
8 namespace {{namespace}} { | 8 namespace {{namespace}} { |
9 {% endfor %} | 9 {% endfor %} |
10 | 10 |
11 ErrorSupport::ErrorSupport() : m_errorString(nullptr) { } | 11 ErrorSupport::ErrorSupport() { } |
12 ErrorSupport::ErrorSupport(String* errorString) : m_errorString(errorString) { } | 12 ErrorSupport::~ErrorSupport() { } |
13 ErrorSupport::~ErrorSupport() | |
14 { | |
15 if (m_errorString && hasErrors()) { | |
16 StringBuilder builder; | |
17 builder.append("Internal error(s): "); | |
18 builder.append(errors()); | |
19 *m_errorString = builder.toString(); | |
20 } | |
21 } | |
22 | 13 |
23 void ErrorSupport::setName(const String& name) | 14 void ErrorSupport::setName(const String& name) |
24 { | 15 { |
25 DCHECK(m_path.size()); | 16 DCHECK(m_path.size()); |
26 m_path[m_path.size() - 1] = name; | 17 m_path[m_path.size() - 1] = name; |
27 } | 18 } |
28 | 19 |
29 void ErrorSupport::push() | 20 void ErrorSupport::push() |
30 { | 21 { |
31 m_path.push_back(String()); | 22 m_path.push_back(String()); |
(...skipping 29 matching lines...) Expand all Loading... |
61 if (i) | 52 if (i) |
62 builder.append("; "); | 53 builder.append("; "); |
63 builder.append(m_errors[i]); | 54 builder.append(m_errors[i]); |
64 } | 55 } |
65 return builder.toString(); | 56 return builder.toString(); |
66 } | 57 } |
67 | 58 |
68 {% for namespace in config.protocol.namespace %} | 59 {% for namespace in config.protocol.namespace %} |
69 } // namespace {{namespace}} | 60 } // namespace {{namespace}} |
70 {% endfor %} | 61 {% endfor %} |
OLD | NEW |