Skip to content

Commit

Permalink
Merge pull request #4903 from hippware/logging-followups
Browse files Browse the repository at this point in the history
Logging followups
  • Loading branch information
aksonov authored Mar 11, 2020
2 parents 6e21d44 + c6e4cc5 commit b3f70f5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
12 changes: 9 additions & 3 deletions patches/@absinthe+socket+0.2.1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ index 9e5f12d..2c38c75 100644
const onTimeout = (absintheSocket, notifier) =>
notifierNotifyActive(
diff --git a/node_modules/@absinthe/socket/src/subscription.js b/node_modules/@absinthe/socket/src/subscription.js
index de44085..0b46b29 100644
index de44085..1abe8c1 100644
--- a/node_modules/@absinthe/socket/src/subscription.js
+++ b/node_modules/@absinthe/socket/src/subscription.js
@@ -7,6 +7,7 @@ import type {
Expand All @@ -182,12 +182,18 @@ index de44085..0b46b29 100644

import abortNotifier from "./abortNotifier";
import notifierFind from "./notifier/find";
@@ -143,6 +144,9 @@ const onDataMessage = (
@@ -143,6 +144,15 @@ const onDataMessage = (
if (notifier) {
notifierNotifyResultEvent(notifier, payload.result);
}
+ else {
+ notifyBugsnag(new Error('Subscription not found'), 'absinthe_socket_subscription_error', payload)
+ notifyBugsnag(new Error('Subscription not found'),
+ 'absinthe_socket_subscription_error',
+ {
+ payload,
+ notifiers: absintheSocket.notifiers,
+ }
+ )
+ }
};

Expand Down
3 changes: 1 addition & 2 deletions src/store/FirebaseStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ const FirebaseStore = types

// NOTE: this is not a MST action
async function processFirebaseAuthChange(user: any) {
log('FIREBASESTORE: AUTH STATE CHANGED', !!user)
log(user)
log('FIREBASESTORE: AUTH STATE CHANGED', user)
if (user) {
try {
await auth!.currentUser!.reload()
Expand Down
7 changes: 3 additions & 4 deletions third-party/wocky-client/src/actionLogger.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {getPath, IMiddlewareEvent} from 'mobx-state-tree'
import {log} from '../../../src/utils/logger'

// Based off https://github.com/mobxjs/mobx-state-tree/blob/master/packages/mst-middlewares/src/simple-action-logger.ts
export function actionLogger(call: IMiddlewareEvent, next: (call: IMiddlewareEvent) => void) {
if (call.type === 'action' && call.parentId === 0) {
const base = '[MST] ' + getPath(call.context) + '/' + call.name
if (call.args.length === 0) {
// tslint:disable-next-line
console.log(base)
log(base)
} else {
// tslint:disable-next-line
console.log(base + ' args:', call.args)
log(base + ' args:', call.args)
}
}
return next(call)
Expand Down
6 changes: 5 additions & 1 deletion third-party/wocky-client/src/transport/Transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {IProfilePartial, FriendShareTypeEnum, IFriendShareConfig} from '../model
import {ILocationSnapshot, IBotPost} from '..'
import {IBot, IBotIn} from '../model/Bot'
import {ILocation} from '../model/Location'
import {notifyBugsnag} from '../../../../src/utils/logger'

const introspectionQueryResultData = require('./fragmentTypes.json')
const TIMEOUT = 10000
Expand Down Expand Up @@ -1367,7 +1368,10 @@ export class Transport {
res = await this.mutate({mutation, variables})
if (res.data && !res.data![name].successful) {
// console.error('voidMutation error with ', name, JSON.stringify(res.data[name]))
throw new Error(`GraphQL ${name} error: ${JSON.stringify(res.data![name])}`)
notifyBugsnag(
new Error(`GraphQL ${name} error: ${JSON.stringify(res.data![name])}`),
`graphql_${name}_error`
)
}
}

Expand Down

0 comments on commit b3f70f5

Please sign in to comment.