Capture Error Messages

Add custom errors into the LogRocket dashboard

Manually surface error messages in LogRocket

Use captureMessage() to manually report a message. This message will be treated as an error within LogRocket.

LogRocket.captureMessage('Something is wrong!', {
  tags: {
    // additional data to be grouped as "tags"
    subscription: 'Pro',
  extra: {
    // additional arbitrary data associated with the event
    pageName: 'ProfileView',

Add tags and extra fields to send extra metadata about the message. The values contained in the tags and extra objects must be scalar values (e.g., booleans, numbers, or strings). Tags and extra data will appear with the error in the Issues view of the LogRocket dashboard.


Some tags are reserved. The following tag keys will be omitted from the Custom Tags section:

  • browser
  • level
  • logger
  • os
  • release
  • transaction
  • url
  • user

Automatically aggregate console errors in LogRocket

shouldAggregateConsoleErrors - Boolean

optional (default - false)

Use this option to control whether aggregated data about messages logged with console.error() or LogRocket.error() is surfaced as an error in LogRocket.

LogRocket.init(YOUR_APP_ID, {
  console: {
    shouldAggregateConsoleErrors: true,


Aggregated console errors do not include stack traces. Use LogRocket.captureException() for stack traces to be included when source maps are in use.