From c33dc49e40faab38d91445e9e91af5efe987d36a Mon Sep 17 00:00:00 2001 From: Karl-Aksel Puulmann Date: Sun, 27 Jan 2019 22:10:52 +0200 Subject: [PATCH] Attach a default onError handler, logging to console.error (#706) --- src/mapbox/mapbox.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mapbox/mapbox.js b/src/mapbox/mapbox.js index 93cbca896..4304f1dcc 100644 --- a/src/mapbox/mapbox.js +++ b/src/mapbox/mapbox.js @@ -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. */ @@ -73,7 +79,7 @@ const defaultProps = { visible: true, onLoad: noop, - onError: noop, + onError: defaultOnError, width: 0, height: 0,