#143 handle undefined console messages
This commit is contained in:
parent
b06fb4cb80
commit
d33b6a354f
2 changed files with 21 additions and 5 deletions
|
@ -58,11 +58,20 @@ class Console extends React.Component {
|
|||
appendConsoleEvent(consoleEvent) {
|
||||
const args = consoleEvent.arguments;
|
||||
const method = consoleEvent.method;
|
||||
const nextChild = (
|
||||
let nextChild;
|
||||
if (Object.keys(args).length === 0) {
|
||||
nextChild = (
|
||||
<div key={this.children.length} className="preview-console__undefined">
|
||||
<span key={`${this.children.length}-0`}>{'undefined'}</span>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
nextChild = (
|
||||
<div key={this.children.length} className={`preview-console__${method}`}>
|
||||
{Object.keys(args).map((key) => <span key={`${this.children.length}-${key}`}>{args[key]}</span>)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
this.children.push(nextChild);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
.preview-console__undefined {
|
||||
@include themify(){
|
||||
color: getThemifyVariable('inactive-text-color');
|
||||
}
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
.preview-console__error {
|
||||
color: $console-error-color;
|
||||
flex: 1 0 auto;
|
||||
|
|
Loading…
Reference in a new issue