Skip to content

dataCallback overwritten by angular plugin #477

Closed
@thomasjachmann

Description

@thomasjachmann

When using the angular plugin, the dataCallback method I set in the config options is overwritten by the plugin.

Raven.config("mydsn", {
  dataCallback: function(data) {
    console.log "my data callback was called";
    return data;
  }
}).install();

The provided callback will be stored in _globalOptions.dataCallback during config(). After that, install() will call angularPlugin which calls Raven.setDataCallback - overwriting my callback. There are two solutions here:

  1. The plugin should create a wrapper method that first calls the already registered callback (if any) and then does it's own work.
  2. There should not only be one callback but several, registered in an array that will be called one after the other. The downside would be that:
    • either the name for registering data callbacks would be called setDataCallback although it wouldn't set but add it
    • or the method would be renamed, breaking backwards compatibility. This could be avoided by keeping setDataCallback which would erase all other callbacks and add addDataCallback or registerDataCallback which would just add the callback to the array.

I could create a PR if one approach is acceptable.

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