Skip to content

Commit

Permalink
Attach a default onError handler, logging to console.error (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
macobo authored and Pessimistress committed Jan 27, 2019
1 parent cc4c3cf commit c33dc49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mapbox/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import {document} from '../utils/globals';

function noop() {}

function defaultOnError(event?: { error: any }) {
if (event) {
console.error(event.error); // eslint-disable-line
}
}

const propTypes = {
// Creation parameters
container: PropTypes.object, /** The container to have the map. */
Expand Down Expand Up @@ -73,7 +79,7 @@ const defaultProps = {
visible: true,

onLoad: noop,
onError: noop,
onError: defaultOnError,

width: 0,
height: 0,
Expand Down

0 comments on commit c33dc49

Please sign in to comment.