Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerbenw committed Aug 28, 2024
1 parent 3ba1473 commit 153bba4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ Prior to v8, calls to `notify` triggered change detection cycles which could aff
### Validation of BugSnag endpoints

As of v8, for consistency with other BugSnag platforms, if only one [endpoint](https://docs.bugsnag.com/platforms/javascript/configuration-options/#endpoints) is set in configuration, no events **or** sessions will be sent. To correctly setup BugSnag for on-premise, both `notify` and `sessions` endpoint should be set. This change reduces the possibility of a misconfigured client leaking data to the wrong BugSnag server.

### `request` replaced with `url` and `method` in network breadcrumb metadata

Prior to v8, network breadcrumb metadata included a field named `request`, which contained the request URL prepended with the HTTP method (e.g. `"GET https://request-url.com/`). This has been replaced with two separate metadata fields named `url` and `method`, which contain the request URL and HTTP method respectively.

## `bugsnag-react-native@*` to `@bugsnag/react-native@7.3`

As of `v7.3` of the [`bugsnag-js` monorepo](https://github.com/bugsnag/bugsnag-js) it contains Bugsnag's SDK for React Native. This additional notifier joins `@bugsnag/js` and `@bugsnag/expo` in its unified version scheme, so the first version of `@bugsnag/react-native` is `v7.3.0`.
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Bugsnag = {
const original = bugsnag[m]
bugsnag[m] = function () {
// if we are in an async context, use the client from that context
const contextClient = bugsnag._clientContext && bugsnag._clientContext.getStore() ? bugsnag._clientContext.getStore() : null
const contextClient = bugsnag._clientContext && typeof bugsnag._clientContext.getStore === 'function' ? bugsnag._clientContext.getStore() : null
const client = contextClient || bugsnag
const originalMethod = contextClient ? contextClient[m] : original

Expand Down Expand Up @@ -103,7 +103,7 @@ Object.keys(Client.prototype).forEach((m) => {
Bugsnag[m] = function () {
// if we are in an async context, use the client from that context
let client = Bugsnag._client
if (client && client._clientContext && client._clientContext.getStore()) {
if (client && client._clientContext && typeof client._clientContext.getStore === 'function') {
client = client._clientContext.getStore()
}

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-node-uncaught-exception/uncaught-exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module.exports = {
if (!client._config.enabledErrorTypes.unhandledExceptions) return
_handler = err => {
// if we are in an async context, use the client from that context
const c = (client._clientContext && client._clientContext.getStore()) ? client._clientContext.getStore() : client
const c = (client._clientContext && typeof client._clientContext.getStore === 'function') ? client._clientContext.getStore() : client

// check if the stacktrace has no context, if so, if so append the frames we created earlier
// check if the stacktrace has no context, if so append the frames we created earlier
// see plugin-contextualize for where this is created
if (err.stack && c.fallbackStack) maybeUseFallbackStack(err, c.fallbackStack)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return
_handler = err => {
// if we are in an async context, use the client from that context
const c = (client._clientContext && client._clientContext.getStore()) ? client._clientContext.getStore() : client
const c = (client._clientContext && typeof client._clientContext.getStore === 'function') ? client._clientContext.getStore() : client

const event = c.Event.create(err, false, {
severity: 'error',
Expand Down

0 comments on commit 153bba4

Please sign in to comment.