From 7d2633c5d17d2ef9cb417db74c1bc71be9d2d838 Mon Sep 17 00:00:00 2001 From: Riley Date: Mon, 10 Jan 2022 15:38:58 -0800 Subject: [PATCH] error handling (#144) * log error and dont emit * save --- lerna.json | 2 +- packages/components/package.json | 10 +++++----- packages/react-inbox/package.json | 6 +++--- packages/react-preferences/package.json | 2 +- packages/react-provider/package.json | 2 +- packages/react-provider/src/transports/types.ts | 1 + packages/react-provider/src/ws.ts | 5 +++++ packages/react-toast/package.json | 4 ++-- packages/storybook/package.json | 12 ++++++------ packages/types/package.json | 2 +- 10 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lerna.json b/lerna.json index e1c40ee1..d2d42591 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "packages": ["packages/*"], - "version": "1.3.2", + "version": "1.3.3", "npmClient": "yarn", "useWorkspaces": true, "command": { diff --git a/packages/components/package.json b/packages/components/package.json index d474a1a8..5f4ee1a4 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/components", - "version": "1.3.2", + "version": "1.3.3", "private": true, "description": "Beautiful, easy React toast notifications", "author": "Courier ", @@ -17,10 +17,10 @@ "license": "MIT", "dependencies": { "@trycourier/courier": "^1.3.0", - "@trycourier/react-inbox": "^1.3.2", - "@trycourier/react-preferences": "^1.3.2", - "@trycourier/react-provider": "^1.3.2", - "@trycourier/react-toast": "^1.3.2", + "@trycourier/react-inbox": "^1.3.3", + "@trycourier/react-preferences": "^1.3.3", + "@trycourier/react-provider": "^1.3.3", + "@trycourier/react-toast": "^1.3.3", "babel-loader": "^8.0.6", "babel-preset-preact": "^2.0.0", "camel-case": "^4.1.2", diff --git a/packages/react-inbox/package.json b/packages/react-inbox/package.json index 7c25ee37..ffedeef0 100644 --- a/packages/react-inbox/package.json +++ b/packages/react-inbox/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/react-inbox", - "version": "1.3.2", + "version": "1.3.3", "description": "", "main": "dist/index.js", "types": "typings/index.d.ts", @@ -22,8 +22,8 @@ "dependencies": { "@apollo/client": "^3.3.11", "@tippyjs/react": "^4.2.3", - "@trycourier/react-preferences": "^1.3.2", - "@trycourier/react-provider": "^1.3.2", + "@trycourier/react-preferences": "^1.3.3", + "@trycourier/react-provider": "^1.3.3", "classnames": "^2.2.6", "date-fns": "^2.19.0", "deep-extend": "^0.6.0", diff --git a/packages/react-preferences/package.json b/packages/react-preferences/package.json index 3830912c..7cc94c96 100644 --- a/packages/react-preferences/package.json +++ b/packages/react-preferences/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/react-preferences", - "version": "1.3.2", + "version": "1.3.3", "main": "dist/index.js", "types": "typings/index.d.ts", "scripts": { diff --git a/packages/react-provider/package.json b/packages/react-provider/package.json index f3e41c08..99e7bc57 100644 --- a/packages/react-provider/package.json +++ b/packages/react-provider/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/react-provider", - "version": "1.3.2", + "version": "1.3.3", "description": "", "main": "dist/index.js", "types": "typings/index.d.ts", diff --git a/packages/react-provider/src/transports/types.ts b/packages/react-provider/src/transports/types.ts index a0bd2b01..92f77cd6 100644 --- a/packages/react-provider/src/transports/types.ts +++ b/packages/react-provider/src/transports/types.ts @@ -10,6 +10,7 @@ export interface IActionBlock { } export interface ICourierMessage { event?: string; + error?: string; body?: string | React.ReactElement; blocks?: Array; icon?: string | false; diff --git a/packages/react-provider/src/ws.ts b/packages/react-provider/src/ws.ts index 57315693..b8fc5f2d 100644 --- a/packages/react-provider/src/ws.ts +++ b/packages/react-provider/src/ws.ts @@ -79,6 +79,11 @@ export class WS { return; } + if (message.error) { + console.error(message.error); + return; + } + for (const sub of this.subscriptions) { if (sub.event !== "*" && sub.event !== message?.event) { continue; diff --git a/packages/react-toast/package.json b/packages/react-toast/package.json index cb09d9b8..dc0157ce 100644 --- a/packages/react-toast/package.json +++ b/packages/react-toast/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/react-toast", - "version": "1.3.2", + "version": "1.3.3", "description": "Beautiful, easy React toast notifications", "main": "dist/index.js", "types": "typings/index.d.ts", @@ -25,7 +25,7 @@ "concat-md": "^0.3.5" }, "dependencies": { - "@trycourier/react-provider": "^1.3.2", + "@trycourier/react-provider": "^1.3.3", "deep-extend": "^0.6.0", "react-toastify": "^6.2.0", "rimraf": "^3.0.2", diff --git a/packages/storybook/package.json b/packages/storybook/package.json index a6432d95..05d7eb5b 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/storybook", - "version": "1.3.2", + "version": "1.3.3", "private": true, "description": "Beautiful, easy React toast notifications", "author": "Courier ", @@ -22,11 +22,11 @@ "@storybook/addon-links": "^6.1.14", "@storybook/addon-viewport": "^6.4.9", "@storybook/react": "^6.1.14", - "@trycourier/components": "^1.3.2", - "@trycourier/react-inbox": "^1.3.2", - "@trycourier/react-preferences": "^1.3.2", - "@trycourier/react-provider": "^1.3.2", - "@trycourier/react-toast": "^1.3.2", + "@trycourier/components": "^1.3.3", + "@trycourier/react-inbox": "^1.3.3", + "@trycourier/react-preferences": "^1.3.3", + "@trycourier/react-provider": "^1.3.3", + "@trycourier/react-toast": "^1.3.3", "react-markdown": "^6.0.1", "storybook": "^6.1.21", "styled-components": "^5.2.1", diff --git a/packages/types/package.json b/packages/types/package.json index 301bca0b..ef1a7399 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,7 +1,7 @@ { "name": "@trycourier/types", "private": true, - "version": "1.3.2", + "version": "1.3.3", "main": "index.d.ts", "types": "index.d.ts", "scripts": {}