2018-09-13 11:58:05 -04:00
|
|
|
import React, { Fragment } from 'react';
|
2019-05-27 13:26:29 -04:00
|
|
|
import PropTypes from 'prop-types';
|
2018-09-13 11:58:05 -04:00
|
|
|
|
2018-09-13 18:55:53 -04:00
|
|
|
function ErrorBox(props){
|
2018-09-30 15:30:04 -04:00
|
|
|
if (props.msg) {
|
|
|
|
console.error(props.msg);
|
|
|
|
}
|
2018-09-13 18:55:53 -04:00
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{
|
|
|
|
(props.msg)?
|
2019-05-27 11:39:16 -04:00
|
|
|
(
|
|
|
|
<div className="alert alert-danger" role="alert">
|
|
|
|
{
|
|
|
|
(typeof props.msg === 'string' || props.msg instanceof String)?
|
|
|
|
props.msg
|
|
|
|
: 'Unexpected error'
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
) : null
|
2018-09-13 18:55:53 -04:00
|
|
|
}
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
2018-09-13 11:58:05 -04:00
|
|
|
|
2019-05-27 13:26:29 -04:00
|
|
|
ErrorBox.propTypes = {
|
|
|
|
msg: PropTypes.string
|
|
|
|
}
|
|
|
|
|
2018-09-13 11:58:05 -04:00
|
|
|
export default ErrorBox;
|