Skip to content

Property 'error' doesn't exist when passing custom error metadata #2601

@roni-castro-shipt

Description

@roni-castro-shipt

Steps to reproduce

Add this to a react-native project and tap that button in debug mode.

import Bugsnag from '@bugsnag/react-native';
import { Button, View } from 'react-native';

export default function App() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Button
        title="simulate error"
        onPress={() => {
          try {
            throw new Error('custom error is not logged');
          } catch (error) {
            Bugsnag.notify(new Error('Failed to initialize SDK'), event => {
              event.severity = 'warning';
              event.addMetadata('Additional Info', { originalError: error }); // this is throwing an error and not being included in metadata in debug mode
            });
          }
        }}
      />
    </View>
  );
}
 ERROR  [bugsnag] Error occurred in onError callback, continuing anyway…
 ERROR  [bugsnag] [ReferenceError: Property 'error' doesn't exist]

This does not seem to happen in production, though, and it keeps passing originalError as an AdditionalInfo. Just in debug mode, it throws that error and ignores that property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions