Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Commit

Permalink
Fix breadcrumbs to discard unusable metadata instead of cancelling call
Browse files Browse the repository at this point in the history
* Replace invalid metadata with empty object
* Allow any object type as breadcrumb metadata

Fixes #36
  • Loading branch information
kattrali committed Dec 8, 2016
2 parents 0599eb4 + ffac2a8 commit 262b991
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Bugsnag.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ export class Client {
if (metadata.constructor === String) {
metadata = {'message': metadata };
}
if (!metadata instanceof Map) {
console.warn('Breadcrumb metadata is not a Map or String');
return;
if (!metadata instanceof Object) {
console.warn('Breadcrumb metadata is not an Object or String, discarding');
metadata = {};
}
let type = metadata['type'] || 'manual';
delete metadata['type'];
Expand Down Expand Up @@ -244,7 +244,7 @@ const typedMap = function(map) {
const output = {};
for (const key in map) {
const value = map[key];
if (value instanceof Map || value instanceof Object) {
if (value instanceof Object) {
output[key] = {type: 'map', value: typedMap(value)};
} else {
const type = typeof value;
Expand Down

0 comments on commit 262b991

Please sign in to comment.