From e976c45f888b8e45f0744c311eabc49a0e80c1d6 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 2 Dec 2021 11:46:32 -0500 Subject: [PATCH] Using console.error for error logs. (#517) --- src/server/index.tsx | 4 +++- src/shared/components/common/image-upload-form.tsx | 1 + src/shared/components/common/markdown-textarea.tsx | 1 + src/shared/components/person/settings.tsx | 2 +- src/shared/components/post/post-form.tsx | 1 + src/shared/components/search.tsx | 2 +- src/shared/services/WebSocketService.ts | 2 +- 7 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server/index.tsx b/src/server/index.tsx index 0fc35149..5bf79f17 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -90,6 +90,7 @@ server.get("/*", async (req, res) => { // Redirect to the 404 if there's an API error if (routeData[0] && routeData[0].error) { let errCode = routeData[0].error; + console.error(errCode); return res.redirect(`/404?err=${errCode}`); } @@ -174,7 +175,8 @@ server.get("/*", async (req, res) => { `); } catch (err) { - console.log(err); + console.error(err); + return res.redirect(`/404?err=${err}`); } }); diff --git a/src/shared/components/common/image-upload-form.tsx b/src/shared/components/common/image-upload-form.tsx index 5e5f1e09..9b0fb84d 100644 --- a/src/shared/components/common/image-upload-form.tsx +++ b/src/shared/components/common/image-upload-form.tsx @@ -104,6 +104,7 @@ export class ImageUploadForm extends Component< .catch(error => { i.state.loading = false; i.setState(i.state); + console.error(error); toast(error, "danger"); }); } diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index d5ed4a92..ea5bea17 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -365,6 +365,7 @@ export class MarkdownTextArea extends Component< .catch(error => { i.state.imageLoading = false; i.setState(i.state); + console.error(error); toast(error, "danger"); }); } diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index 2678f9c8..dff29590 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -796,7 +796,7 @@ export class Settings extends Component { true ); } catch (err) { - console.log(err); + console.error(err); } }, 400), false diff --git a/src/shared/components/post/post-form.tsx b/src/shared/components/post/post-form.tsx index 22f78c3f..f7b05818 100644 --- a/src/shared/components/post/post-form.tsx +++ b/src/shared/components/post/post-form.tsx @@ -565,6 +565,7 @@ export class PostForm extends Component { .catch(error => { i.state.imageLoading = false; i.setState(i.state); + console.error(error); toast(error, "danger"); }); } diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 596b7e59..bf660ab5 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -785,7 +785,7 @@ export class Search extends Component { choices.unshift({ value: "0", label: i18n.t("all") }); this.communityChoices.setChoices(choices, "value", "label", true); } catch (err) { - console.log(err); + console.error(err); } }, 400), false diff --git a/src/shared/services/WebSocketService.ts b/src/shared/services/WebSocketService.ts index ea5d3f6e..87d8f979 100644 --- a/src/shared/services/WebSocketService.ts +++ b/src/shared/services/WebSocketService.ts @@ -27,7 +27,7 @@ export class WebSocketService { try { obs.next(JSON.parse(e.data.toString())); } catch (err) { - console.log(err); + console.error(err); } }) .onOpen(() => {