@honeybadger-io/react-native 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -3,17 +3,19 @@ declare namespace honeybadger {
3
3
  /**
4
4
  * Initialize and configure the Honeybadger React Native library.
5
5
  * @param {string} apiKey - Your Honeybadger API key.
6
+ * @param {boolean} [reportErrors=true] reportErrors - Whether to send error reports to Honeybadger (disable for dev environments, etc.)
6
7
  * @param {string=} revision - The git revision of the current build.
7
8
  * @param {string=} projectRoot - The path to the project root.
8
9
  */
9
- function configure(apiKey: string, revision?: string, projectRoot?: string): void;
10
+ function configure(apiKey: string, reportErrors?: boolean, revision?: string, projectRoot?: string): void;
10
11
  /**
11
12
  * Initialize and configure the Honeybadger React Native library.
12
13
  * @param {string} apiKey - Your Honeybadger API key.
14
+ * @param {boolean} [reportErrors=true] reportErrors - Whether to send error reports to Honeybadger (disable for dev environments, etc.)
13
15
  * @param {string=} revision - The git revision of the current build.
14
16
  * @param {string=} projectRoot - The path to the project root.
15
17
  */
16
- function configure(apiKey: string, revision?: string, projectRoot?: string): void;
18
+ function configure(apiKey: string, reportErrors?: boolean, revision?: string, projectRoot?: string): void;
17
19
  /**
18
20
  * Send any kind of error, exception, object, String, etc. to Honeybadger.
19
21
  * @param {string|object} err - The error string or object.
package/index.js CHANGED
@@ -17,6 +17,7 @@ let _logLevel = "warning"; // "error", "warning", "debug"
17
17
  let _previousJSGlobalExceptionHandler = null;
18
18
  let _revision = "";
19
19
  let _projectRoot = "";
20
+ let _reportErrors = true;
20
21
 
21
22
 
22
23
 
@@ -28,10 +29,11 @@ const honeybadger = {
28
29
  /**
29
30
  * Initialize and configure the Honeybadger React Native library.
30
31
  * @param {string} apiKey - Your Honeybadger API key.
32
+ * @param {boolean} [reportErrors=true] reportErrors - Whether to send error reports to Honeybadger (disable for dev environments, etc.)
31
33
  * @param {string=} revision - The git revision of the current build.
32
34
  * @param {string=} projectRoot - The path to the project root.
33
35
  */
34
- configure ( apiKey, revision = '', projectRoot = '' )
36
+ configure ( apiKey, reportErrors = true, revision = '', projectRoot = '' )
35
37
  {
36
38
  if ( !isValidAPIKey(apiKey) )
37
39
  {
@@ -42,6 +44,7 @@ const honeybadger = {
42
44
  _apiKey = apiKey.trim();
43
45
  _revision = (revision || '').trim();
44
46
  _projectRoot = (projectRoot || '').trim();
47
+ _reportErrors = reportErrors;
45
48
 
46
49
  if ( !_initialized )
47
50
  {
@@ -229,10 +232,13 @@ function setNativeExceptionHandler() {
229
232
 
230
233
 
231
234
  function sendToHoneybadger(payload) {
232
- if ( !payload || !isValidAPIKey(_apiKey) ) {
235
+ if ( !payload || !isValidAPIKey(_apiKey) || !_reportErrors ) {
233
236
  return;
234
237
  }
235
238
 
239
+
240
+ logDebug("Sending error report to Honeybadger...");
241
+
236
242
  const params = {
237
243
  method: 'POST',
238
244
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honeybadger-io/react-native",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Honeybadger.io for React Native.",
5
5
  "author": "Andrey Butov <andreybutov@antair.com> (https://andreybutov.com)",
6
6
  "license": "MIT",